2012-01-30 73 views
5

我已經在我的Mac上安裝了Python 3.2,我想用setuptool的easy_install安裝一些軟件包。Python 3在mac上的setuptools

唉,我的easy_install已經被(使用命令行自動完成)的唯一版本:

easy_install  easy_install-2.5 easy_install-2.6 

如何安裝包爲Python 3.2?

附錄

我已經按照Thomas K的建議:

$ curl -O http://python-distribute.org/distribute_setup.py 
$ python distribute_setup.py 

,但沒有運氣,easy_install還安裝Python 2.6包:

$ easy_install beautifulsoup 
Searching for beautifulsoup 
Best match: BeautifulSoup 3.2.0 
Processing BeautifulSoup-3.2.0-py2.6.egg 

如何強制到的easy_install檢索Python 3.2包而不是?

回答

5

您需要安裝setuptools的 - 或者說,叫叉「分配」,因爲原來的setuptools不支持Python 3的

這裏有指示:http://pypi.python.org/pypi/distribute#installation-instructions

+0

我跟着指示(見附錄),但發行版已安裝在我的Python 2.6上。 – 2012-01-31 09:11:50

+1

@AdamMatan:然後你用Python 2.6運行安裝。它安裝在你用來運行安裝的python中。非常容易和明顯。 – 2012-01-31 14:31:22

4

像這樣:

$ curl -O http://python-distribute.org/distribute_setup.py 
$ python3.2 distribute_setup.py 
     ^^^ 

甚至:

$ curl -O http://python-distribute.org/distribute_setup.py 
$ /the/path/to/the/python/where/you/want/it/installed/bin/python distribute_setup.py 
0

以下的其他指令後:

curl -O http://python-distribute.org/distribute_setup.py 
python3.2 distribute_setup.py 

如果你使用官方Python3包,當您安裝distribute_setup.py,它把Python3容易在文件系統中的/庫/框架的組成部分安裝腳本。要運行的easy_install的Python3版本,你需要使用下面的根

/Library/Frameworks/Python.framework/Versions/3.3/bin/easy_install 

或地方的符號鏈接到它在/ usr/local/bin目錄:

sudo ln -s /Library/Frameworks/Python.framework/Versions/3.3/bin/easy_install-3.3 /usr/local/bin/