在Python中安装包时出现异常

时间:2013-03-15 12:05:13

标签: python django python-2.7

我在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

3 个答案:

答案 0 :(得分:1)

可能你错过了c ++编译器。

我使用here

中的预打包版本安装了它

答案 1 :(得分:0)

我的问题出在了一个虚拟现实中。我无法安装一些软件包并得到同样的致命错误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”。

答案 2 :(得分:0)

得到相同的错误消息,发现原因是当我使用Visual Studio和Python的路径正确设置PATH变量时,我忘了添加C:\ Windows \ System32路径。