我有python版本3.3。我沒有安裝pip,現在試圖安裝matplotlib和numpy。嘗試使用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))
你的系統上是否安裝了編譯器,如gcc? – shuttle87
您需要一個C編譯器來構建用C語言編寫的python擴展,實質上只是抓取源代碼包並嘗試構建它。大多數情況下,它不涉及預先構建的二進制文件。它看起來像你在OSX上。如果是這樣,你需要安裝XCode(或一個精簡的等價物)。或者,您可以使用預先構建的二進制文件安裝matplotlib,numpy等(只要確保它們是針對您使用的相同python可執行文件構建的)。另一種選擇是python發行版,如Anaconda,Canopy等。 –
@Joe Kington,我下載了xcode並安裝了它。我仍然得到同樣的錯誤。 – user1471980