安装python27第三方库pycaypto时报错,错误信息:
Running setup.py install for pycrypto ... error
ERROR: Command errored out with exit status 1:
command: 'E:\Python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\80786\\appdata\\local\\temp\\pip-install-3bxsnu\\pycrypto\\setup.py'"'"'; __file__='"'"'c:\\users\\80786\\appdata\\local\\temp\\pip-install-3bxsnu\\pycrypto\\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\80786\appdata\local\temp\pip-record-tknyo2\install-record.txt' --single-version-externally-managed --compile
cwd: c:\users\80786\appdata\local\temp\pip-install-3bxsnu\pycrypto\
Complete output (150 lines):
......................................................
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Random.OSRNG.winrandom' extension
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
----------------------------------------
ERROR: Command errored out with exit status 1: 'E:\Python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\80786\\appdata\\local\\temp\\pip-install-3bxsnu\\pycrypto\\setup.py'"'"'; __file__='"'"'c:\\users\\80786\\appdata\\local\\temp\\pip-install-3bxsnu\\pycrypto\\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\80786\appdata\local\temp\pip-record-tknyo2\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
----------------------------------------------------end-------------------------------------------------------------------------------
错误信息中,提示需要安装Microsoft Visual C++ 9.0,进入http://aka.ms/vcpython27,下载VCForPython27.msi安装后,再pip install 包即可成功安装