pip install cx_freeze:“command'cl.exe'失败:没有这样的文件或目录”

时间:2016-09-15 21:50:28

标签: command-line pip failed-installation cl.exe

我在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 ++ **:Screenshot

我在C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\安装了vcvars *批次:

  • vcvarsall.bat
  • bin\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分钟的安装。所以我最好先问一下。

1 个答案:

答案 0 :(得分:0)

确定。解决。

我根据this Question的答案成功地从方向盘安装了cx_freeze。

但是来自Gohlke网站的version 4.3.4在Python 3.5(ImportError: No module named '_frozen_importlib_external')下有一个错误。我们必须等到cx_freeze作者releases the next version of cx_freeze(似乎很快)。

与此同时,Sebastian Krause非常善于使用repo,cx_freeze 5.0中的最新代码创建一些轮子,这些轮子在我的测试中安装并运行时没有错误。