下载python包失败

2024-05-19 17:08:15 发布

您现在位置:Python中文网/ 问答频道 /正文

我最近在我的Windows8计算机上安装了Python3。 当我试图从命令行使用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).

最初的例外是:

^{pr2}$

以及

"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();

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


Tags: installpipinstalledpybuildnumpyyouconfig
1条回答
网友
1楼 · 发布于 2024-05-19 17:08:15

Numpy有几个组件需要编译,因此需要一个C++编译器,例如安装在VisualStudio中的一个:

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

通常在Windows上使用the Python Extension Packages provided by Christoph Gohlke或一个Python发行版(如Anaconda)会更容易些,这将为您提供二进制文件。在

相关问题 更多 >