2015-01-01 168 views
0

安裝某些python模塊(例如pandas)時出現問題,並且在安裝ipython notebook時也有一些問題。Python Pip安裝「Egg」錯誤(Pandas和其他模塊)

這個錯誤似乎已經出現在其他人(Python pip install fails: invalid command egg_info)之前,但他們使用的是Python 2.7,而我使用的是2.6(我的Mac OS 10.6默認)。我也嘗試easy_install -U setuptools和pip install - 升級setuptools,但都沒有工作。

這是錯誤,我得到了安裝熊貓:

Command python setup.py egg_info failed with error code 1 in /private/var/folders/Wm/WmmbYincEnuCrAMtGBudAk+++TM/-Tmp-/pip_build_AWal/pandas 
Storing debug log for failure in /Users/AWal/Library/Logs/pip.log 

對於安裝IPython的,這是我的錯誤:

Exception: 
Traceback (most recent call last): 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/commands/install.py", line 283, in run 
    requirement_set.install(install_options, global_options, root=options.root_path) 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 1435, in install 
    requirement.install(install_options, global_options, *args, **kwargs) 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 671, in install 
    self.move_wheel_files(self.source_dir, root=root) 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/req.py", line 901, in move_wheel_files 
    pycompile=self.pycompile, 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/wheel.py", line 341, in move_wheel_files 
    generated.extend(maker.make_multiple(['%s = %s' % kv for kv in console.items()])) 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 316, in make_multiple 
    filenames.extend(self.make(specification, options)) 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 305, in make 
    self._make_script(entry, filenames, options=options) 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 209, in _make_script 
    self._write_script(scriptnames, shebang, script, filenames, ext) 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/scripts.py", line 189, in _write_script 
    self._fileop.write_binary_file(outname, script_bytes) 
    File "/Library/Python/2.6/site-packages/pip-1.5.4-py2.6.egg/pip/_vendor/distlib/util.py", line 384, in write_binary_file 
    with open(path, 'wb') as f: 
IOError: [Errno 13] Permission denied: '/usr/local/bin/sphinx-apidoc' 

Storing debug log for failure in /Users/AWal/Library/Logs/pip.log 

做什麼有什麼想法?

UPDATE:

當我做須藤PIP安裝熊貓(我不能安裝其他模塊),我得到一個長長的回溯與最終錯誤消息:

RuntimeError: Broken toolchain: cannot link a simple C program 

而且回溯(它的100行左右)的樣本是這樣的:

Traceback (most recent call last): 

    File "<string>", line 17, in <module> 

    File "/private/tmp/pip_build_root/pandas/setup.py", line 619, in <module> 

    **setuptools_kwargs) 

    File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/core.py", line 113, in setup 

    File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 266, in __init__ 

    File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 312, in fetch_build_eggs 

    File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 753, in resolve 

    File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 1005, in best_match 

    File "build/bdist.macosx-10.6-universal/egg/pkg_resources/__init__.py", line 1017, in obtain 

    File "build/bdist.macosx-10.6-universal/egg/setuptools/dist.py", line 379, in fetch_build_egg 

    File "build/bdist.macosx-10.6-universal/egg/setuptools/command/easy_install.py", line 619, in easy_install 
+0

室內用嘗試admin權限 – Hackaholic

+0

@Hackaholic嘗試須藤PIP安裝熊貓(另一個模塊這是不工作),並且我得到了同樣的錯誤:命令python setup.py egg_info失敗,並在/ private/tmp/pip_build_root/pandas中的錯誤代碼1 在/ Users/AWal/Library/Logs/pip中存儲故障的調試日誌.log – user3736169

+1

這可能是相關的http://stackoverflow.com/questions/22388519/problems-with-pip-install-numpy-r untimeerror-broken-toolchain-can-link-a – cel

回答

0

一個權限被拒絕的消息,建議你以root身份運行命令由Hackaholic的建議。 嘗試sudo pip install YOUR_PACKAGE

您可能還想看看virtualenv以使用更加獨立的環境。 在基於debian的發行版中,您可以安裝帶有apt-get install python-virtualenv的python-virtualenv軟件包。

然後製造出任何通過鍵入virtualenv whatever(這將創建當前文件夾中的文件夾whatever虛擬環境的名稱。 然後cd它和類型斌/激活進入這個虛擬環境。 從那裏再試您pip install命令。

可能有助於

UPDATE: 你可以嘗試使用可用的here

建議的解決方案10

要sumup,嘗試添加export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future~/.bash_profile

+1

基本上,virtualenv是一個很好的選擇。要在Mac上安裝它(沒有''apt-get''),你可以關注這個[post](http://jamie.curle.io/blog/installing-pip-virtualenv-and-virtualenvwrapper-on-os -X/)。但是,OP中的更新表明,C編譯器可能存在問題,這也需要解決。 – sthzg

+0

@sthzg我認爲它也是編譯器的問題。我只是試圖在bash_profile命令中導出ARCHFLAGS命令,以及一個模塊(這次是numpy,另一個模塊不會爲我安裝):sudo ARCHFLAGS = -Wno-error = unused-command-line-argument-hard-未來的錯誤點安裝 - 升級numpy。不幸的是,我得到了另一個錯誤:命令/ usr/bin/python -c「import setuptools,tokenize; __ file __ ='/ private/tmp/pip_build_root/numpy/setup.py'; exec(compile(getattr(tokenize,'open ',打開)(__ file __)。read()。replace('\ r \ n','\ n'),__file__,'exec'))「etc .... – user3736169

+0

@ user3736169你](http://stackoverflow.com/questions/22388519/problems-with-pip-install-numpy-runtimeerror-broken-toolchain-cannot-link-a),有人解釋說,他們不得不打開XCode一種類型並接受這個建議:「我只需打開XCode並接受協議並讓它安裝工具即可。」也可能對您有所幫助。 – rebrec

0

這個問題是第一位在谷歌,但second一個實際工作:

pip install -U setuptools 

pip install ez_setup