$ pip install pyinstaller
后运行:
$ pyinstaller -F 文件
pyinstaller无法在命令行运行,会提示报错:
failed to create process.
PHPz2017-04-17 17:53:04
I learned about a bug that seems to be pip
Spaces in Python path make pip-installed launchers fail on Windowspip
的一個 bug Spaces in Python path make pip-installed launchers fail on Windows
原因分析:
簡單來說就是 shebang line (script 裡面指定 python path 的那一行) 裡面有空白導致的,可能就是安裝 Python 的路徑上有空白而且 pip
在安裝的時候沒正確幫你加上引號,例如你的 Python 在:
C:\Program Files (x86)\Python35-32\python.exe
^ ^
空白惹事
然後用 pip
:
pip
did not add it correctly for you during installation. Upper quotes, for example your Python is in:
#!C:\Program Files (x86)\Python35-32\python.exe <-- 這個 shebang line 有問題,因為空白
# EASY-INSTALL-ENTRY-SCRIPT: 'PyInstaller==3.1.1','console_scripts','pyinstaller'
Then use pip
to install Pyinstaller's script. The spaces in the path are not used correctly. Quotation marks are handled well:
#!"C:\Program Files (x86)\Python35-32\python.exe" <-- 這個 shebang line 有問題,因為空白,我們補上前後的引號
# EASY-INSTALL-ENTRY-SCRIPT: 'PyInstaller==3.1.1','console_scripts','pyinstaller'
The above are the reasonsSolution🎜:🎜 🎜There are some workarounds to solve the problem. The first one is to go directly to the script of pyinstaller and use quotation marks to solve the whitespace problem (in the Script subdirectory of the Python directory): 🎜
C:>"C:\Program Files (x86)\Python35-32\python.exe" "C:\Program Files (x86)\Python35-32\Scripts\pyinstaller-script.py" script_to_compile.py
🎜Or run the script directly using Python (not through the shebang line):🎜
rrreee
🎜I found out that someone else used a trick, reinstalling Python so that there is no blank space in the path (laughing), it is really a trick. 🎜阿神2017-04-17 17:53:04
Are you still using Python on Windows? And you don’t need Conda?
Read this article quickly
[Original] Container Definition Application: Container Revolution for Data Science