【发布时间】:2015-04-09 10:21:50
【问题描述】:
我根本无法在 Windows 上安装 NumPy。我不断收到此错误 -
PS C:\python27> pip install http://sourceforge.net/projects/numpy/file/NumPy/
Collecting http://sourceforge.net/projects/numpy/files/NumPy/
Downloading http://sourceforge.net/projects/numpy/files/NumPy/ (58kB)
100% |################################| 61kB 15kB/s
Cannot unpack file c:\users\toshiba\appdata\local\temp\pip-qev4rz-unpack\NumPy
(downloaded from c:\users\toshiba\appdata\local\temp\pip-omripn-build, content-type: text/html; charset=utf-8); cannot detect archive format
Cannot determine archive format of c:\users\toshiba\appdata\local\temp\pip-omripn-build
我之前有一个 Python 64 位版本,我不确定 NumPy 版本是否与 64 位 Python 兼容。所以我卸载了它并安装了一个 32 位的 Python 版本。但我仍然遇到同样的错误。虽然我的 Python 32 位版本运行良好。
我尝试了“pip install numpy”,但最后给了我以下错误-
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
error: Unable to find vcvarsall.bat
----------------------------------------
Command "C:\Python27\python.exe -c "import setuptools,tokenize;__file__='c:\\users\\toshiba\\appdata\\local\\temp\\pip-build-hdhqex\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'),__file__, 'exec'))" install --record c:\users\toshiba\appdata\local\temp\pip-x_6llm-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\toshiba\appdata\local\temp\pip-build-hdhqex\numpy
我可能做错了什么?
【问题讨论】:
-
vcvarsall.bat是 Visual Studio 的一部分,因此您必须安装它。然后检查这个答案stackoverflow.com/questions/2667069/… -
您可能会喜欢 Anaconda,这是一个 Python 发行版,内置了大多数流行的定量工作库。
-
Mailerdaimon 这是我在尝试预编译版本时的错误 PS C:\Users\toshiba\downloads> pip install numpy-1.9.2rc1+mkl-cp27-none-win_amd64.whl numpy-1.9.2rc1+ mkl-cp27-none-win_amd64.whl 不是这个平台支持的轮子。
-
numpyinstallation docs 明确建议使用 anaconda/miniconda。