以下是我安装时的命令和报错信息,公司不允许上外网,所以下载了模块,进行离线安装
D:\program\Python 2.7.12\Scripts>pip install --no-index --find-links="D:\program
\Python 2.7.12\packages" psutil
Collecting psutil
Building wheels for collected packages: psutil
Running setup.py bdist_wheel for psutil ... error
Complete output from command "D:\program\Python 2.7.12\python.exe" -u -c "impo
rt setuptools, tokenize;__file__='d:\\users\\luxuem~1\\appdata\\local\\temp\\pip
-build-8l0zfh\\psutil\\setup.py';f=getattr(tokenize, 'open', open)(__file__);cod
e=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))
" bdist_wheel -d d:\users\luxuem~1\appdata\local\temp\tmpedtiqqpip-wheel- --pyth
on-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\psutil
copying psutil\compat.py -> build\lib.win-amd64-2.7\psutil
copying psutil\error.py -> build\lib.win-amd64-2.7\psutil
copying psutil\_psbsd.py -> build\lib.win-amd64-2.7\psutil
copying psutil\_pslinux.py -> build\lib.win-amd64-2.7\psutil
copying psutil\_psmswindows.py -> build\lib.win-amd64-2.7\psutil
copying psutil\_psosx.py -> build\lib.win-amd64-2.7\psutil
copying psutil\_psposix.py -> build\lib.win-amd64-2.7\psutil
copying psutil\__init__.py -> build\lib.win-amd64-2.7\psutil
running build_ext
building '_psutil_mswindows' extension
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Ge
t it from http://aka.ms/vcpython27
----------------------------------------
Failed building wheel for psutil
Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil
Running setup.py install for psutil ... error
Complete output from command "D:\program\Python 2.7.12\python.exe" -u -c "im
port setuptools, tokenize;__file__='d:\\users\\luxuem~1\\appdata\\local\\temp\\p
ip-build-8l0zfh\\psutil\\setup.py';f=getattr(tokenize, 'open', open)(__file__);c
ode=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'
))" install --record d:\users\luxuem~1\appdata\local\temp\pip-hkqb8l-record\inst
all-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\psutil
copying psutil\compat.py -> build\lib.win-amd64-2.7\psutil
copying psutil\error.py -> build\lib.win-amd64-2.7\psutil
copying psutil\_psbsd.py -> build\lib.win-amd64-2.7\psutil
copying psutil\_pslinux.py -> build\lib.win-amd64-2.7\psutil
copying psutil\_psmswindows.py -> build\lib.win-amd64-2.7\psutil
copying psutil\_psosx.py -> build\lib.win-amd64-2.7\psutil
copying psutil\_psposix.py -> build\lib.win-amd64-2.7\psutil
copying psutil\__init__.py -> build\lib.win-amd64-2.7\psutil
running build_ext
building '_psutil_mswindows' extension
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
Get it from http://aka.ms/vcpython27
----------------------------------------
Command ""D:\program\Python 2.7.12\python.exe" -u -c "import setuptools, tokeniz
e;__file__='d:\\users\\luxuem~1\\appdata\\local\\temp\\pip-build-8l0zfh\\psutil\
\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r
\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record d:\
users\luxuem~1\appdata\local\temp\pip-hkqb8l-record\install-record.txt --single-
version-externally-managed --compile" failed with error code 1 in d:\users\luxue
m~1\appdata\local\temp\pip-build-8l0zfh\psutil\
D:\program\Python 2.7.12\Scripts>
我下载的tar.gz格式的源文件,安装的源文件包含c或者c++源码,安装的时候会调用本地的编译器编译这类文件,从报错来看是没有找到指定的版本Microsoft Visual C++ 9.0
解决方案有三种:
1、下载已经编译好的.whl文件,先安装wheel,然后安装.whl格式的模块
pip install wheel
pip install --no-index --find-links="D:\program\Python 2.7.12\packages" psutil
第2种和第3种解决方案:
http://blog.csdn.net/liwugang43210/article/details/50732920