【问题标题】:Python 3 setuptools on macMac 上的 Python 3 安装工具
【发布时间】:2012-02-22 08:13:22
【问题描述】:

我已经在我的 Mac 上安装了 Python 3.2,我想使用 setuptool 的 easy_install 安装一些包。

唉,我唯一的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 包?

【问题讨论】:

    标签: macos python-3.x setuptools


    【解决方案1】:

    您需要安装 setuptools - 或者更确切地说是名为“distribute”的分支,因为原始 setuptools 不支持 Python 3。

    这里有说明:http://pypi.python.org/pypi/distribute#installation-instructions

    【讨论】:

    • 我已按照说明操作(请参阅附录),但在我的 Python 2.6 上安装了分发版。
    • @AdamMatan:然后您使用 Python 2.6 运行安装。它安装在您用于运行安装的 python 中。非常简单明了。
    【解决方案2】:

    像这样:

    $ 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
    

    【讨论】:

      【解决方案3】:

      按照其他说明操作后:

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

      如果您使用过官方 Python3 包,当您安装 Distribute_setup.py 时,它会将 Python3 轻松安装脚本放在文件系统的 /Library/Frameworks 部分。要运行 Python3 版本的 easy_install,需要以 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/
      

      【讨论】:

        猜你喜欢
        • 2011-05-05
        • 1970-01-01
        • 2018-04-12
        • 2015-07-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-02-24
        • 2021-02-26
        相关资源
        最近更新 更多