简体   繁体   中英

Exception while installing packages in Python

I am Getting this Exception while installing packages in Python. uninstalled python and installed it again but there is no

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

Probably you are missing the c++ compiler.

I installed it using a pre-packaged version from here

My problem was inside a virtualenv. I could not install some packages and got the same fatal error c1083. I was trying Visual Studio and PTVS. Just installing Microsoft Visual C++ Compiler for Python 2.7 https://www.microsoft.com/en-us/download/details.aspx?id=44266 was not enough to fix the error, despite it is needed.

I have found the solution here http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/

The setuptools installed by virtualenv is too old (3.6). You need to remove it and reinstalling but, in the "Install python package" window in Visual Studio solution explorer, instead of using "setuptools" as the module name to install use "setuptools>=6.0".

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM