windows 通过pip安装pyinstaller导致“无法创建进程”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31808180/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing pyinstaller via pip leads to "failed to create process"
提问by phillipsK
Does anyone know why pyinstaller
immediately fails after installed via pip
via anaconda 32bit
?
有谁知道为什么pyinstaller
通过pip
via安装后立即失败anaconda 32bit
?
I installed pyinstaller via pip install pyinstaller
through the anaconda command prompt on Windows 64 bit using 32 bit anaconda (because I want to create 32 bit executables)
我pip install pyinstaller
使用 32 位 anaconda 通过 anaconda 命令提示符在 Windows 64 位上安装了 pyinstaller (因为我想创建 32 位可执行文件)
Yes I read pyinstaller --version failed to create a processand pip/easy_install failure: failed to create processand How to install pyinstaller using pip
是的,我读了pyinstaller --version failed to create a process和pip/easy_install failure: failed to create processand How to install pyinstaller using pip
I did not rename any files I installed anaconda 15 mins ago, pycharm 10 mins ago, and pyinstaller 5 mins ago. I uninstalled pyinstaller via pup uninstall and reinstalled in the anaconda scripts folder, this did nothing.
我没有重命名 15 分钟前安装的 anaconda、10 分钟前安装的 pycharm 和 5 分钟前安装的 pyinstaller 的任何文件。我通过 pup uninstall 卸载了 pyinstaller 并重新安装在 anaconda 脚本文件夹中,这没有任何作用。
Any insight anyone? #windowsfrustrations
Path
C:\Users\me\Anaconda\Lib\site-packages>PyInstaller
任何人的见解?#windowsfrustrations 路径
C:\Users\me\Anaconda\Lib\site-packages>PyInstaller
回答by Janzert
[Update: So apparently the root fix for this is in setuptools. The fix went into setuptools version 24.3.1 released July 23, 2016. Upgrading to anything newer than that should take care of this.]
[更新:很明显,这个问题的根本修复是在 setuptools 中。该修复程序进入了 2016 年 7 月 23 日发布的 setuptools 版本 24.3.1。升级到任何更新的版本都应该解决这个问题。]
It turns out this is a bug in pip. As mentioned in the other answer it has a problem with spaces in the path to the python install.
事实证明这是pip 中的一个错误。正如在另一个答案中提到的那样,python 安装路径中的空格有问题。
Specifically it leaves out quote marks in the generated launcher scripts. The scripts can be found in \Scripts\ (e.g. C:\Program Files\Python 3.5\Scripts). For pyinstaller there 4 pyi-* and a pyinstaller-script.py scripts.
具体来说,它在生成的启动器脚本中省略了引号。脚本可以在\Scripts\(例如C:\Program Files\Python 3.5\Scripts)中找到。对于 pyinstaller,有 4 个 pyi-* 和一个 pyinstaller-script.py 脚本。
You can work around this relatively easily by editing the first line of each script. The generated first lines will look something like:
您可以通过编辑每个脚本的第一行来相对轻松地解决此问题。生成的第一行看起来像:
#!c:\program files\python 3.5\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'PyInstaller==3.1.1','console_scripts','pyinstaller'
Just add quotes around the shebang command, like so:
只需在 shebang 命令周围添加引号,如下所示:
#!"c:\program files\python 3.5\python.exe"
回答by AthanasiusOfAlex
This error seems to occur when Python's (or PyInstaller's) path contains a space (for example, when one installs Python to the Program Files (x86)
directory.)
当 Python 的(或 PyInstaller 的)路径包含空格时(例如,当将 Python 安装到Program Files (x86)
目录时),似乎会发生此错误。
I suspect that somewhere in PyInstaller's source code there are some missing quotation marks.
我怀疑在 PyInstaller 的源代码中的某个地方缺少一些引号。
Try installing Python in a path without spaces, and installing PyInstaller (via pip) to that path.
尝试在没有空格的路径中安装 Python,并将 PyInstaller(通过 pip)安装到该路径。
回答by Guillaume Jacquenot
As StationaryTraveller mentioned, you can work around this bug by calling script pyinstaller-script.py
正如 StationaryTraveller 提到的,您可以通过调用脚本来解决此错误 pyinstaller-script.py
Below is an example
下面是一个例子
C:>"C:\Program Files (x86)\Python35-32\python.exe" "C:\Program Files (x86)\Python35-32\Scripts\pyinstaller-script.py" script_to_compile.py
回答by Harald Scheirich
As of July 2016 the issue was reported as fixed, ugrading pip, setuptools and then uninstalling and installing pyinstaller should remedy the problem
截至 2016 年 7 月,该问题已报告为已修复,升级 pip、setuptools 然后卸载并安装 pyinstaller 应该可以解决问题
回答by StationaryTraveller
I fixed it [Anaconda 3.4] by doing this:
我通过这样做修复了它 [Anaconda 3.4]:
- Enter Anaconda Command Prompt
- Get to anaconda scripts folder by: cd /path/to/anaconda/Scripts
- Write: python pyinstaller-script.py path/YourScript.py
- 输入Anaconda 命令提示符
- 通过以下方式进入 anaconda 脚本文件夹:cd /path/to/anaconda/Scripts
- 写:python pyinstaller-script.py path/YourScript.py
Worked like a charm.
像魅力一样工作。
回答by A Sim?es
I had the same issue, even with pip and setuptools updated, and the problem was that pyinstaller-script.py, found in C:\Python35\Scripts\ directory, had the wrong path for python.exe.
我遇到了同样的问题,即使 pip 和 setuptools 已更新,问题是在 C:\Python35\Scripts\ 目录中找到的 pyinstaller-script.py 的 python.exe 路径错误。
Python on my system was somehow installed in AppData, but its' scripts and modules were being installed in C:\Python35\ folder.
我系统上的 Python 以某种方式安装在 AppData 中,但其脚本和模块安装在 C:\Python35\ 文件夹中。
Changing the first line of pyinstaller-script.py to the correct path of python.exe (Programs directory inside AppData), with quotes if there's any space in the folders' names inbetween, and it should work and no longer show the "Failed to create process". Example:
将 pyinstaller-script.py 的第一行更改为 python.exe 的正确路径(AppData 中的 Programs 目录),如果文件夹名称之间有任何空格,则使用引号,并且它应该可以工作并且不再显示“Failed to创建过程”。例子:
#!C:\Program" "Files" "(x86)\Python\python.exe
Using Windows10 and Python35 official installer got Python installed there somehow.
使用 Windows10 和 Python35 官方安装程序以某种方式在那里安装了 Python。
回答by zyc
python -m pip install pip
worked for me.
python -m pip install pip
对我来说有效。
With Anaconda version of Python 3.5.2 and 3.6.0(Upgraded for this error, but the error appears to be the same with both versions), I had encountered the same error message with command pip install pip
, or pip install whatever
/ conda install whatever
.
使用 Anaconda 版本的 Python 3.5.2 和 3.6.0(针对此错误进行了升级,但两个版本的错误似乎相同),我遇到了相同的错误消息 command pip install pip
,或pip install whatever
/ conda install whatever
。
I had both Python 2.7 and 3.5, but pip install --upgrade pip
had been working every day, until a few days ago.
我有 Python 2.7 和 3.5,但pip install --upgrade pip
每天都在工作,直到几天前。
回答by suneth rajamanthri
"C:\Program Files\Python35-32\python.exe" "C:\Program Files\Python35-32\Scripts\pyinstaller-script.py" --onefile --windowed ex_btn.py
"C:\Program Files\Python35-32\python.exe" "C:\Program Files\Python35-32\Scripts\pyinstaller-script.py" --onefile --windowed ex_btn.py
--onefile : create only exe, --windowed : exclude the prompting CMD, ex_btn.py : python script file.
--onefile : 只创建 exe, --windowed : 排除提示 CMD, ex_btn.py : python 脚本文件。
This worked like charm.
这就像魅力一样。
回答by Arman
In my case, I uninstall and install pyinstaller, then every things work well.
就我而言,我卸载并安装 pyinstaller,然后一切正常。
It may relate to any changes within python after installation, so re-installing is a good choice.
可能与安装后python内部的任何变化有关,因此重新安装是一个不错的选择。
uninstall:
卸载:
pip uninstall pyinstaller
install:
安装:
pip install pyinstaller