Python 尝试使用pip安装matplotlib和numpy时出错
我有python版本3.3。我确实安装了pip,现在尝试安装matplotlib和numpyPython 尝试使用pip安装matplotlib和numpy时出错,python,numpy,matplotlib,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.customi
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
网站了解更多安装信息:我发现了一个简单的
导出CC=gcc
解决了我的问题。
(安装了Xcode的OSX,但有相同的错误)这对我来说很有效(OSX 10.8.5)
安装Xcode(从应用商店)
启动Xcode
在其首选项中,下载、选择命令行工具并等待安装
您可以退出Xcode
在终端:
CC=gcc
pip3安装matplotlib
pip3安装六个
我运行最近下载的python 3.4
我必须在matplotlib上加上6个才能让pyplot正常运行您的系统上安装了这样一个gcc编译器吗?您需要一个C编译器来构建用C编写的python扩展。
pip
基本上只需获取一个源代码tarball并尝试构建它。在大多数情况下,它不处理预构建的二进制文件。看起来你在OSX上。如果是这样,您将需要安装XCode(或一个精简的等效程序)。或者,您可以使用预构建的二进制文件来安装matplotlib、numpy等(只需确保它们是根据您正在使用的相同python可执行文件构建的)。另一个选择是python发行版,如Anaconda、Canopy等@Joe Kington,我下载了xcode并安装了它。我仍然会犯同样的错误。