Python 3在Mac上的setuptools

5

我在我的Mac上安装了Python 3.2,并希望使用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 包?
3个回答

5

我按照说明(请参见附录)操作,但是distribute被安装在我的Python 2.6上。 - Adam Matan
1
@AdamMatan:然后你使用Python 2.6运行了安装程序。它会在你用来运行安装程序的Python中进行安装。非常简单和明显。 - Lennart Regebro

3

就像这样:

$ 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脚本放置在文件系统的/Library/Frameworks部分。要运行easy_install的Python3版本,您需要以root身份使用以下命令。
/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/

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接