安装手套蟒蛇时出错:'cl.exe'失败,退出状态为 2



我正在尝试在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(可再发行组件安装在我的Windows 10上,以尝试解决问题。

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

注意:错误中写入的路径适用于适用于python 2.7的Microsoft Visual C ++(但我使用的是python35(,因此这可能是错误的原因?

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

这是错误:

C:UsersESCA>pip3 install glove-python
Collecting glove-python
Using cached glove_python-0.1.0.tar.gz
Requirement already satisfied: numpy in c:usersescaappdatalocalprogramspythonpython35libsite-packages (from glove-python)
Requirement already satisfied: scipy in c:usersescaappdatalocalprogramspythonpython35libsite-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:usersescaappdatalocalprogramspythonpython35python.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('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:UsersESCAAppDataLocalTemptmp0war2fdwpip-wheel- --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating buildlib.win-amd64-3.5
creating buildlib.win-amd64-3.5glove
copying glovecorpus.py -> buildlib.win-amd64-3.5glove
copying gloveglove.py -> buildlib.win-amd64-3.5glove
copying glove__init__.py -> buildlib.win-amd64-3.5glove
running build_ext
building 'glove.glove_cython' extension
creating buildtemp.win-amd64-3.5
creating buildtemp.win-amd64-3.5Release
creating buildtemp.win-amd64-3.5Releaseglove
C:UsersESCAAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0VCbincl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:usersescaappdatalocalprogramspythonpython35include -Ic:usersescaappdatalocalprogramspythonpython35include /Tcglove/glove_cython.c /Fobuildtemp.win-amd64-3.5Releaseglove/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:usersescaappdatalocalprogramspythonpython35includepyconfig.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:usersescaappdatalocalprogramspythonpython35python.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('rn', '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:usersescaappdatalocalprogramspythonpython35python.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('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersESCAAppDataLocalTemppip-gs05_i6s-recordinstall-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
running build_ext
building 'glove.glove_cython' extension
C:UsersESCAAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0VCbincl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Ic:usersescaappdatalocalprogramspythonpython35include -Ic:usersescaappdatalocalprogramspythonpython35include /Tcglove/glove_cython.c /Fobuildtemp.win-amd64-3.5Releaseglove/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:usersescaappdatalocalprogramspythonpython35includepyconfig.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:usersescaappdatalocalprogramspythonpython35python.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('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersESCAAppDataLocalTemppip-gs05_i6s-recordinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersESCAAppDataLocalTemppip-build-4tm726dcglove-python

在编译时尝试此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 Community,然后从VS命令提示符执行python setup.py install,为你设置所有包含目录,安装社区后出现的VS2015 x64 native toolsMSBuild command prompt for VS2015。 请注意,VS2015版本至少需要社区来构建Python模块,因为它们摆脱了先前通过Microsoft可再发行组件进行编译的能力。

相关内容

最新更新