python - 尝试使用 pip 安装 matplotlib 和 numpy 时出现错误

标签 python numpy matplotlib

我的Python版本是3.3。我确实安装了 pip,现在尝试安装 matplotlib 和 numpy。

pip install matplotlib
pip install numpy

我收到这些错误:

File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/distutils/sysconfig.py", line 191, in customize_compiler

    _osx_support.customize_compiler(_config_vars)

  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/_osx_support.py", line 418, in customize_compiler

    _find_appropriate_compiler(_config_vars)

  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/_osx_support.py", line 191, in _find_appropriate_compiler

    "Cannot locate working compiler")

SystemError: Cannot locate working compiler

----------------------------------------
Cleaning up...
  Removing temporary dir /private/var/folders/fz/4bjb8_8x4rs_8r97vrh92_mh0000gn/T/pip_build_ayseburcuozdal...
Command python setup.py egg_info failed with error code 1 in /private/var/folders/fz/4bjb8_8x4rs_8r97vrh92_mh0000gn/T/pip_build_ayseburcuozdal/numpy
Exception information:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.5-py3.3.egg/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.5-py3.3.egg/pip/commands/install.py", line 270, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.5-py3.3.egg/pip/req.py", line 1206, in prepare_files
    req_to_install.run_egg_info()
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.5-py3.3.egg/pip/req.py", line 312, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/pip-1.5-py3.3.egg/pip/util.py", line 696, in call_subprocess
    % (command_desc, proc.returncode, cwd))

最佳答案

Numpy 需要 C 编译器才能安装。此错误消息表明您没有安装 C 编译器,或者 pip 找不到它。

或者,如果您没有可用的编译器,您也可以获取 numpy 的二进制文件。有关更多安装信息,请参阅 numpy 网站:http://docs.scipy.org/doc/numpy/user/install.html

关于python - 尝试使用 pip 安装 matplotlib 和 numpy 时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21193936/

相关文章:

python - Python 和 Numpy 中自定义 NaN float 的行为

python - 如何将 NumPy 1.18.5 for Python3.8 与 Anaconda 一起使用?

python - 如何使用OpenCV将图像的一部分复制到另一个?

python-2.7 - 顶部有线条的多轴图。 Matplotlib

python - 在 Linux 上使用 Webdav 从 SkyDrive 获取文件 *无需* 安装

python - pygraphviz 1.5 默认边缘没有箭头?

python - 覆盖 y 轴刻度标签而不影响 pyplot 中的图形形状

python - 如何使用 Matplotlib 缩放体素尺寸?

Python:Urllib2 返回 404

python - 在 Python 中以图形方式显示对象和引用