安装glove-python时出错:' cl.exe'退出状态2失败

时间:2017-07-05 06:02:26

标签: windows-10 cython python-3.5

我正在尝试在python3.5(x64)上安装glove-python包,我得到了错误,如下所示。

请注意,我有TDM-GCC-64,MinGW32,MinGW64,Cygwin,microsot visual c ++ for python 2.7,microsoft visual 2008(x64)和microsoft visual c ++ 2015(x64)Redistributable安装在我的Windows 10上试图解决问题。

我尝试了许多解决方案,例如使用mingw32 / cygwin / mingw64创建distutils.cfg文件来构建包,但我的所有试验都给了我不同的错误!所以我删除了distutils.cfg文件,但这也给了我一个错误,如下所示。

注意:错误中写的路径是针对python 2.7的microsoft visual c ++(但我使用的是python35),这可能是导致错误的原因?

此外,我觉得错误可能是由于Cython没有运行。我使用pip install安装了Cython 0.25.2。但是当我运行pycharm调试器时,它给了我一个警告,调试器使用未找到的cython加速。同时我在构建时遇到错误(在我的试用期间以不同的方式安装包)#34 ; glove.glove_cython"

这是错误:

C:\Users\ESCA>pip3 install glove-python
Collecting glove-python
Using cached glove_python-0.1.0.tar.gz
Requirement already satisfied: numpy in c:\users\esca\appdata\local\programs\python\python35\lib\site-packages (from glove-python)
Requirement already satisfied: scipy in c:\users\esca\appdata\local\programs\python\python35\lib\site-packages (from glove-python)
Building wheels for collected packages: glove-python
Running setup.py bdist_wheel for glove-python ... error
Complete output from command c:\users\esca\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ESCA\\AppData\\Local\\Temp\\pip-build-4tm726dc\\glove-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\ESCA\AppData\Local\Temp\tmp0war2fdwpip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\glove
copying glove\corpus.py -> build\lib.win-amd64-3.5\glove
copying glove\glove.py -> build\lib.win-amd64-3.5\glove
copying glove\__init__.py -> build\lib.win-amd64-3.5\glove
running build_ext
building 'glove.glove_cython' extension
creating build\temp.win-amd64-3.5
creating build\temp.win-amd64-3.5\Release
creating build\temp.win-amd64-3.5\Release\glove
C:\Users\ESCA\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\bin\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\users\esca\appdata\local\programs\python\python35\include -Ic:\users\esca\appdata\local\programs\python\python35\include /Tcglove/glove_cython.c /Fobuild\temp.win-amd64-3.5\Release\glove/glove_cython.obj -fopenmp -ffast-math -march=native
 cl : Command line warning D9002 : ignoring unknown option '-fopenmp'
 cl : Command line warning D9002 : ignoring unknown option '-ffast-math'
 cl : Command line warning D9002 : ignoring unknown option '-march=native'
 glove_cython.c
 c:\users\esca\appdata\local\programs\python\python35\include\pyconfig.h(68) : fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Users\\ESCA\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\bin\\cl.exe' failed with exit status 2

----------------------------------------
Failed building wheel for glove-python
Running setup.py clean for glove-python
Complete output from command c:\users\esca\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ESCA\\AppData\\Local\\Temp\\pip-build-4tm726dc\\glove-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
 or: -c --help [cmd1 cmd2 ...]
 or: -c --help-commands
 or: -c cmd --help

error: option --all not recognized

----------------------------------------
Failed cleaning build dir for glove-python
Failed to build glove-python
Installing collected packages: glove-python
Running setup.py install for glove-python ... error
Complete output from command c:\users\esca\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ESCA\\AppData\\Local\\Temp\\pip-build-4tm726dc\\glove-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\ESCA\AppData\Local\Temp\pip-gs05_i6s-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
running build_ext
building 'glove.glove_cython' extension
C:\Users\ESCA\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\bin\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:\users\esca\appdata\local\programs\python\python35\include -Ic:\users\esca\appdata\local\programs\python\python35\include /Tcglove/glove_cython.c /Fobuild\temp.win-amd64-3.5\Release\glove/glove_cython.obj -fopenmp -ffast-math -march=native
cl : Command line warning D9002 : ignoring unknown option '-fopenmp'
cl : Command line warning D9002 : ignoring unknown option '-ffast-math'
cl : Command line warning D9002 : ignoring unknown option '-march=native'
glove_cython.c
c:\users\esca\appdata\local\programs\python\python35\include\pyconfig.h(68) : fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Users\\ESCA\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\bin\\cl.exe' failed with exit status 2

----------------------------------------
Command "c:\users\esca\appdata\local\programs\python\python35\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ESCA\\AppData\\Local\\Temp\\pip-build-4tm726dc\\glove-python\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\ESCA\AppData\Local\Temp\pip-gs05_i6s-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ESCA\AppData\Local\Temp\pip-build-4tm726dc\glove-python\

1 个答案:

答案 0 :(得分:0)

在您编译时,请尝试使用此setup.py,对Windows x64计算机中的默认安装目录进行操作:

from Cython.Distutils import build_ext
import numpy as np
import os

try:
    from setuptools import setup
    from setuptools import Extension
except ImportError:
    from distutils.core import setup
    from distutils.extension import Extension

module = 'mymodule'

ext_modules = [Extension(module, sources=[module + '.pyx'],
              include_dirs=['C://Program Files (x86)//Windows Kits//10//Include//10.0.10240.0//ucrt','C://Program Files (x86)//Microsoft Visual Studio 14.0//VC//include','C://Program Files (x86)//Windows Kits//8.1//Include//shared'],
              library_dirs=['C://Program Files (x86)//Windows Kits//8.1//bin//x64', 'C://Windows//System32', 'C://Program Files (x86)//Microsoft Visual Studio 14.0//VC//lib//amd64', 'C://Program Files (x86)//Windows Kits//8.1//Lib//winv6.3//um//x64', 'C://Program Files (x86)//Windows Kits//10//Lib//10.0.10240.0//ucrt//x64'], 
              extra_compile_args=['/Ot', '/favor:INTEL64', '/EHsc', '/GA', '/openmp'],
              language='c++')]

setup(
    name = module,
    ext_modules = ext_modules,
    cmdclass = {'build_ext': build_ext},
    include_dirs = [np.get_include(), os.path.join(np.get_include(), 'numpy')]
    )

请注意,上述内容可能需要对每个包含目录的路径以及您要安装的软件包进行一些严格的修改。您最好使用Windows x64上的Python 3.5来安装Visual Studio 2015社区,然后从VS命令提示符处执行python setup.py install,该命令提示符为您设置所有包含目录,VS2015 x64 native tools或安装社区后出现的MSBuild command prompt for VS2015。请注意,VS2015版本要求Community至少构建Python模块,因为它们已经摆脱了之前通过Microsoft可再发行组件进行编译的能力。