无法为 Python 3.7 64 位安装 cx_Freeze 或 scipy
Can't install cx_Freeze or scipy for Python 3.7 64-bit
我正在尝试安装 cx_Freeze 和 scipy,但我得到
compile failed with error code 1
每次都出错。这是我尝试使用 cx_Freeze:
时看到的内容
error: file 'C:\Users\myAccount\AppData\Local\Temp\pip-install-nabp1tpo\cx-fre
eze\cxfreeze-postinstall' does not exist
----------------------------------------
Command "c:\users\myAccount\appdata\local\programs\python\python37\python.exe -u -
c "import setuptools, tokenize;__file__='C:\Users\myAccount\AppData\Local\Tem
p\pip-install-nabp1tpo\cx-freeze\setup.py';f=getattr(tokenize, 'open', open)(
__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fil
e__, 'exec'))" install --record C:\Users\myAccount\AppData\Local\Temp\pip-record-3
6fbtmht\install-record.txt --single-version-externally-managed --compile" failed
with error code 1 in C:\Users\myAccount\AppData\Local\Temp\pip-install-nabp1tpo\c
x-freeze\
我该如何解决这个问题?
您可以设法从 wheel 安装它。
首先你需要安装轮子:
pip install wheel
然后到下面link根据你的python版本和windows版本下载cx_Freezewheel文件:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze
对于 64 位和 Python 3.7:cx_Freeze‑5.1.1‑cp37‑cp37m‑win_amd64.whl
在命令提示符下将目录更改为下载的文件夹并使用命令:
pip install cx_Freeze‑5.1.1‑cp37‑cp37m‑win_amd64.whl
有关从 wheel 安装的更多说明,请检查以下内容 link:https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels
同样的方法可以解决你的安装问题scipy。
我尝试了 Nischal 的解决方案(有效),但后来 运行 出现了更多错误。
然后我回滚到 python 到 3.6-32 位并且一切正常,只是提醒其他人得到这个,除非你可以安装 cx_freeze 6.0 回滚可能更容易到 python3.6(或制作它的 virtualenv)。
我正在使用 Python 3.7(64 位)
在此处下载 cx_Freeze(取决于您的 Python 版本):
并将此 .whl 文件粘贴到工作目录中。
打开命令提示符,粘贴以下命令并按回车键:
pip install cx_Freeze-5.1.1-cp37-cp37m-win_amd64.whl
请注意,此命令适用于 Python 3.7(64 位)
- 输出应如下所示:
Processing c:\users\Python37\cx_freeze-5.1.1-cp37-cp37m-win_amd64.whl*
Installing collected packages: cx-Freeze*
Successfully installed cx-Freeze-5.1.1*
我下载了 32 位的安装程序,64 位的安装程序不起作用。
pip install cx_Freeze-5.1.1-cp37-cp37m-win32.whl
这对我来说很好用。所以我想没必要降级到 Python 3.6
出现这个问题似乎是因为PyPI 上的版本不是最新的。
当我从 GitHub.
的 master 分支手动下载它时,它对我有用
pip install --upgrade git+https://github.com/anthony-tuininga/cx_Freeze.git@master
从 GitHub 页面上发布的 issue #407 获得了这个答案。
我正在尝试安装 cx_Freeze 和 scipy,但我得到
compile failed with error code 1
每次都出错。这是我尝试使用 cx_Freeze:
时看到的内容 error: file 'C:\Users\myAccount\AppData\Local\Temp\pip-install-nabp1tpo\cx-fre
eze\cxfreeze-postinstall' does not exist
----------------------------------------
Command "c:\users\myAccount\appdata\local\programs\python\python37\python.exe -u -
c "import setuptools, tokenize;__file__='C:\Users\myAccount\AppData\Local\Tem
p\pip-install-nabp1tpo\cx-freeze\setup.py';f=getattr(tokenize, 'open', open)(
__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __fil
e__, 'exec'))" install --record C:\Users\myAccount\AppData\Local\Temp\pip-record-3
6fbtmht\install-record.txt --single-version-externally-managed --compile" failed
with error code 1 in C:\Users\myAccount\AppData\Local\Temp\pip-install-nabp1tpo\c
x-freeze\
我该如何解决这个问题?
您可以设法从 wheel 安装它。
首先你需要安装轮子:
pip install wheel
然后到下面link根据你的python版本和windows版本下载cx_Freezewheel文件: https://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze
对于 64 位和 Python 3.7:cx_Freeze‑5.1.1‑cp37‑cp37m‑win_amd64.whl
在命令提示符下将目录更改为下载的文件夹并使用命令:
pip install cx_Freeze‑5.1.1‑cp37‑cp37m‑win_amd64.whl
有关从 wheel 安装的更多说明,请检查以下内容 link:https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels
同样的方法可以解决你的安装问题scipy。
我尝试了 Nischal 的解决方案(有效),但后来 运行 出现了更多错误。
然后我回滚到 python 到 3.6-32 位并且一切正常,只是提醒其他人得到这个,除非你可以安装 cx_freeze 6.0 回滚可能更容易到 python3.6(或制作它的 virtualenv)。
我正在使用 Python 3.7(64 位)
在此处下载 cx_Freeze(取决于您的 Python 版本):
并将此 .whl 文件粘贴到工作目录中。
打开命令提示符,粘贴以下命令并按回车键:
pip install cx_Freeze-5.1.1-cp37-cp37m-win_amd64.whl
请注意,此命令适用于 Python 3.7(64 位)
- 输出应如下所示:
Processing c:\users\Python37\cx_freeze-5.1.1-cp37-cp37m-win_amd64.whl*
Installing collected packages: cx-Freeze*
Successfully installed cx-Freeze-5.1.1*
我下载了 32 位的安装程序,64 位的安装程序不起作用。
pip install cx_Freeze-5.1.1-cp37-cp37m-win32.whl
这对我来说很好用。所以我想没必要降级到 Python 3.6
出现这个问题似乎是因为PyPI 上的版本不是最新的。 当我从 GitHub.
的 master 分支手动下载它时,它对我有用pip install --upgrade git+https://github.com/anthony-tuininga/cx_Freeze.git@master
从 GitHub 页面上发布的 issue #407 获得了这个答案。