2013-03-15 93 views
4

我在Python中安装包时出现此异常。 卸载Python和再次安装,但没有在Python中安装包时出现异常

C:\Users\ramasastri.g\Desktop\pycrypto-2.6>python setup.py install 
running install 
running build 
running build_py 
running build_ext 
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath. 

building 'Crypto.Random.OSRNG.winrandom' extension 
C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isrc/ -Isrc/inc-msvc/ -IC:\Python27\include -IC:\Python27\PC /Tcsrc/winrand.c /Fobuild\temp.win32-2.7\Release\src/winrand.obj 
winrand.c 
c:\python27\include\pyconfig.h(68) : fatal error C1083: Cannot open include file: 'io.h': No such file or directory 
error: command '"C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\cl.exe"' failed with exit status 2 

回答

1

也许你缺少C++编译器。

我安装它使用预打包的版本从here

+0

我从这里下载它self.but没有用 – user2173860 2013-03-15 12:16:11

+0

看到这个http://stackoverflow.com/questions/10938274/building-pycrypto-with-fastmath-gmp-or-mpir-via-pip-on -windows – Mikael 2013-03-15 12:26:03

+0

不仅适用于PyCrypto,相同的例外适用于安装lxml-3.1.0 – user2173860 2013-03-15 12:44:15

0

我的问题是一个virtualenv中内。我无法安装一些软件包,并得到相同的致命错误c1083。我正在尝试Visual Studio和PTVS。只需安装Microsoft Visual C++ Compiler for Python 2.7 https://www.microsoft.com/en-us/download/details.aspx?id=44266即使需要,也不足以解决该错误。

我发现这里http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/

解决方案通过的virtualenv安装setuptools的太旧(3.6)。您需要删除它并重新安装,但在Visual Studio解决方案资源管理器的“安装Python包”窗口中,而不是使用“setuptools”作为模块名称来安装使用“setuptools> = 6.0”。

0

得到了同样的错误信息,发现原因是,虽然我已经设置了PATH变量与正确的路径到Visual Studio和Python,我忘了加上C:\ Windows \ System32下的路径。