2014-10-17 158 views
1

我試着通過brew與安裝Python:釀造安裝蟒蛇 - 失敗OSX

brew install python 

但得到以下錯誤:

Stevens-MacBook-Pro :: ~ ‹master*› » brew install python 
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/python-2.7. 
Already downloaded: /Library/Caches/Homebrew/python-2.7.8_2.mountain_lion.bottle.tar.gz 
==> Pouring python-2.7.8_2.mountain_lion.bottle.tar.gz 
==> Caveats 
Setuptools and Pip have been installed. To update them 
    pip install --upgrade setuptools 
    pip install --upgrade pip 

You can install Python packages with 
    pip install <package> 

They will install into the site-package directory 
    /usr/local/lib/python2.7/site-packages 

See: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python 

.app bundles were installed. 
Run `brew linkapps` to symlink these to /Applications. 
/usr/bin/install_name_tool: object: /usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python malformed object (unknown load command 10) 
Error: Failed to fix install names 
The formula built, but you may encounter issues using it or linking other 
formula against it. 
==> /usr/local/Cellar/python/2.7.8_2/bin/python -ssetup.py --no-user-cfg instal 
    using one of the approaches described here: 

Please make the appropriate changes for your system and try again. 
Warning: The post-install step did not complete successfully 
You can try again using `brew postinstall python` 
==> Summary 
    /usr/local/Cellar/python/2.7.8_2: 4626 files, 73M 

錯誤消息說,安裝後失敗,嘗試再次安裝它:

brew postinstall python 

但錯誤仍然存​​在。我也試過brew linkapps,它的成功完全鏈接蟒蛇,但是當我從控制檯運行pip我得到這個錯誤:

Stevens-MacBook-Pro :: ~ ‹master*› » pip 
zsh: /usr/local/bin/pip: bad interpreter: @@[email protected]@/opt/python/bin/python2.7: no such file or directory 

任何想法可能什麼錯?

+3

您的install_name_tool看起來很糟糕。 「brew doctor」和「brew config」是什麼意思?如果'brew doctor'給你一個關於install_name_tool的警告,你可以看看使用像Pacifist這樣的工具來重新安裝系統版本。 – 2014-10-17 06:05:55

回答

1

Pyenv是一個Python版本管理工具,類似rbenv,但是用於python。

您可以輕鬆地通過pyenv輕鬆安裝和更改python版本。

下面介紹如何通過pyenv與2.7.8版本安裝python:

[email protected]:~$ pyenv install 2.7.8 
Downloading Python-2.7.8.tgz... 
-> http://yyuu.github.io/pythons/74d70b914da4487aa1d97222b29e9554d042f825f26cb2b93abd20fdda56b557 
Installing Python-2.7.8... 
Installing setuptools from https://bootstrap.pypa.io/ez_setup.py... 
Installing pip from https://bootstrap.pypa.io/get-pip.py... 
Installed Python-2.7.8 to /home/ubuntu/.pyenv/versions/2.7.8 

,你可以看到,它非常簡單。

命令pyenv install "version"幫助您輕鬆安裝特定版本的python甚至pip,setuptools也會自動安裝。

我建議給pyenv一試!

+0

是的,我沒有足夠的聲望留下評論,所以我只是發佈一個答案。感謝您的建議。 – eth3lbert 2014-10-17 11:31:21

+0

當他已經使用自制軟件時,使用pyennv沒有任何意義。 – agconti 2014-10-17 14:28:17

+1

我認爲當你需要在不同版本(py2,py3,pypy)之間工作時,pyenv仍然有用。而且pyenv也在釀造配方清單中。 – eth3lbert 2014-10-17 14:57:21