【发布时间】:2016-09-15 21:50:27
【问题描述】:
我在 Windows 7 上,并且安装了 Python 3.5.1。
我想从 Python 脚本创建可执行文件。
到目前为止我做了什么:
我运行 pip install cx_freeze 并收到 Unable to find vcvarsall.bat 错误。
@Cody Piersall 链接到Steve Dowers blog entry。
我从那里下载并安装了 Visual C++ Build Tools 2015。
现在我已经安装了这些 *Microsoft Visual C++ **´es:Screenshot。
我在C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ 中安装了 vcvars* 批次:
vcvarsall.batbin\vcvars32.bat-
bin\amd64\vcvars64.bat。 - 等
我漂亮的 PATH 是:
C:\run\Python_3_5\Scripts\;
C:\run\Python_3_5\;
C:\Windows\system32;
C:\Windows;
C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
C:\ProgramData\Oracle\Java\javapath;
C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;
C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;
C:\run\Haskell-Platform\lib\extralibs\bin;
C:\run\Haskell-Platform\bin;
C:\Users\Nils-Hero\AppData\Roaming\cabal\bin;
C:\run\Haskell-Platform\mingw\bin;
C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;
C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;
问题:
当我现在重新运行pip install cx_freeze 时,它找不到文件cl.exe:
Collecting cx_freeze
Using cached cx_Freeze-4.3.4.tar.gz
Installing collected packages: cx-freeze
Running setup.py install for cx-freeze ... error
Complete output from command c:\run\python_3_5\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\NILS-H~1\\AppData\\Local\\Temp\\pip-build-9lhua9e9\\cx-freeze\\setup.py'
;exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\NILS-H~1\AppData\Local\Temp\pip-bb2i8jxv-record\install-re
cord.txt --single-version-externally-managed --compile:
adding base module named _bootlocale
adding base module named _collections_abc
adding base module named _compression
...
... adding a lot more base modules ...
...
running install
running build
running build_py
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\cx_Freeze
copying cx_Freeze\common.py -> build\lib.win-amd64-3.5\cx_Freeze
copying cx_Freeze\dist.py -> build\lib.win-amd64-3.5\cx_Freeze
...
... creating and copying a lot more things ...
...
running build_ext
building 'cx_Freeze.util' extension
creating build\temp.win-amd64-3.5\Release
creating build\temp.win-amd64-3.5\Release\source
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\run\python_3_5\include -Ic:\run\python_3_5\include /Tcsource/util.c /Fobuild\temp.win-amd64-3.5\Release\source/util.obj
error: command 'cl.exe' failed: No such file or directory
----------------------------------------
Command "c:\run\python_3_5\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\NILS-H~1\\AppData\\Local\\Temp\\pip-build-9lhua9e9\\cx-freeze\\setup.py';exec(compile(getattr(to
kenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\NILS-H~1\AppData\Local\Temp\pip-bb2i8jxv-record\install-record.txt --single-versio
n-externally-managed --compile" failed with error code 1 in C:\Users\NILS-H~1\AppData\Local\Temp\pip-build-9lhua9e9\cx-freeze\
此可执行文件位于C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\ 下以及子文件夹中。
我猜 pip 找不到它,因为这些路径不在我的 PATH 上,但为什么 Visual C++ Build Tools 2015 安装程序不添加它们?我害怕手动调整 800MB 大小、50 分钟的持久安装。所以我最好先在这里问。
【问题讨论】:
-
我现在可以从轮子上安装 cx_freeze,根据 this answer,但现在它给了
ImportError: No module named '_frozen_importlib_external'- 今天就放弃了。
标签: command-line pip failed-installation cl.exe