无法下载python包

时间:2018-05-08 08:49:56

标签: python windows numpy

我最近在我的Windows 8计算机上安装了python 3。 当我尝试从命令行使用pip下载numpy包时,它无法正常工作。

以下是输出样本:

f:\python\lib\distutils\dist.py:274: UserWarning: Unknown distribution 
option: 'define_macros'
warnings.warn(msg)
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building py_modules sources
building library "npymath" sources
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
error: Could not initialize compiler instance: do you have Visual Studio
installed?  If you are trying to build with MinGW, please use "python setup.py
build -c mingw32" instead.  If you have Visual Studio installed, check it is
correctly installed, and the right version (VS 2008 for python 2.6, 2.7 and 3.2,
VS 2010 for >= 3.3).

最初的例外是:

[WinError 3] The system cannot find the path specified: 'F:\\Visual Studio\\VC\\PlatformSDK\\lib', and the Compiler class was MSVCCompiler

"f:\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\MATRIX~1.MAT\\AppData\\Local\\Temp\\pip-install-rxex02t4\\numpy\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();

首先,它显示了包的下载,似乎只能在安装过​​程中正确下载,我看到了一些错误......

1 个答案:

答案 0 :(得分:0)

Numpy有几个需要编译的组件,因此你需要一个C ++编译器,比如安装Visual Studio的那个:

error: Could not initialize compiler instance: do you have Visual Studio installed?

在Windows上使用the Python Extension Packages provided by Christoph GohlkeAnaconda等Python发行版通常更容易,它将为您提供二进制文件。