Python Forum
the exe file by generated by pyinstaller ,can't get the PYTHONPATH - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: the exe file by generated by pyinstaller ,can't get the PYTHONPATH (/thread-23699.html)

Pages: 1 2


the exe file by generated by pyinstaller ,can't get the PYTHONPATH - roger2020 - Jan-13-2020

The issues as below:
1 run the pyinstaller using A.py, to generate the exe file named A_exe
2 run the A_exe to run the python file B,print the env variable PYTHONPATH,then error happen
3 if I using A.py directly,then Correct,
I am confused.


RE: the exe file by generated by pyinstaller ,can't get the PYTHONPATH - buran - Jan-13-2020

without code it's difficult to guess what is wrong. probably there is some hidden import that pyinstaller is not able to find when creating the exe. Check https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html


RE: the exe file by generated by pyinstaller ,can't get the PYTHONPATH - roger2020 - Jan-13-2020

İmage

İmage


(Jan-13-2020, 08:49 AM)roger2020 Wrote: The issues as below: 1 run the pyinstaller using A.py, to generate the exe file named A_exe 2 run the A_exe to run the python file B,print the env variable PYTHONPATH,then error happen 3 if I using A.py directly,then Correct, I am confused.
(Jan-13-2020, 09:18 AM)buran Wrote: without code it's difficult to guess what is wrong. probably there is some hidden import that pyinstaller is not able to find when creating the exe. Check https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html
Please see the code and results in the pic


RE: the exe file by generated by pyinstaller ,can't get the PYTHONPATH - buran - Jan-13-2020

Links don't work and in any case don't post images - copy paste code/traceback/output in proper tags


RE: the exe file by generated by pyinstaller ,can't get the PYTHONPATH - roger2020 - Jan-13-2020

(Jan-13-2020, 09:51 AM)buran Wrote: Links don't work and in any case don't post images - copy paste code/traceback/output in proper tags

İmage

İmage


Sorry,I can't post code ,because I work in the linux server,I Can't copy the code


RE: the exe file by generated by pyinstaller ,can't get the PYTHONPATH - buran - Jan-13-2020

Your links point to files on your local HD, on Windows OS, although you claim working on linux server....


RE: the exe file by generated by pyinstaller ,can't get the PYTHONPATH - roger2020 - Jan-13-2020

(Jan-13-2020, 10:13 AM)buran Wrote: Your links point to files on your local HD, on Windows OS, although you claim working on linux server....

code is simple:

import os
print os.environ["PYTHONPATH"]


RE: the exe file by generated by pyinstaller ,can't get the PYTHONPATH - Axel_Erfurt - Jan-13-2020

What is PYTHONPATH?

import os
print (os.environ["PATH"])
to show all keys

import os
print (os.environ.keys())



RE: the exe file by generated by pyinstaller ,can't get the PYTHONPATH - buran - Jan-13-2020

In addition - according to your initial post you generate an exe (i.e. Windows executable). Then you introduce the fact you work on linux server. If you want to build executable for linux you must run pyinstaller on the target system and generate the binary there, i.e. windows exe will not run on the linux server.


RE: the exe file by generated by pyinstaller ,can't get the PYTHONPATH - roger2020 - Jan-14-2020

(Jan-13-2020, 03:15 PM)buran Wrote: In addition - according to your initial post you generate an exe (i.e. Windows executable). Then you introduce the fact you work on linux server. If you want to build executable for linux you must run pyinstaller on the target system and generate the binary there, i.e. windows exe will not run on the linux server.

I generate the exe file in linux server, and usr it in linux , not windows!