安装不能在我的Mac上工作?

我有一台运行Python 2.6的Mac。 当我尝试使用easy_install我收到以下消息:

/usr/bin/easy_install-2.6:7: UserWarning: Module pkg_resources was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
  from pkg_resources import load_entry_point
/usr/bin/easy_install-2.6:7: UserWarning: Module site was already imported from /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.pyc, but /Library/Python/2.6/site-packages is being added to sys.path
  from pkg_resources import load_entry_point
Traceback (most recent call last):
  File "/usr/bin/easy_install-2.6", line 10, in <module>
    load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 271, in load_entry_point
    return False
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 2173, in load_entry_point
    deps = []
ImportError: Entry point ('console_scripts', 'easy_install') not found

我很困惑,我想知道我该如何解决这个问题。 以前我没有收到这条消息,然后在安装pip并卸载之后,easy_install不再有效。 我想知道如何解决这个问题,或者在Mac上恢复默认的Python或easy_install设置。


  • 检查你的/ usr / bin和/ usr / local / bin中的easy_install安装并删除任何旧的脚本:

    sudo rm -f /usr/bin/easy_install*
    sudo rm -f /usr/local/bin/easy_install*
    
  • 下载并运行分发:

    curl -O https://svn.apache.org/repos/asf/oodt/tools/oodtsite.publisher/trunk/distribute_setup.py
    
    sudo python distribute_setup.py
    sudo rm distribute_setup.py
    
  • 再试一次,享受。 例如:

    sudo easy_install pip
    

  • 我怀疑再次让easy_install工作的最简单方法是安装distribute ,这是distutils一个改进版本,它捆绑了它自己的easy_install版本。 安装很简单:

    curl -O http://python-distribute.org/distribute_setup.py
    /usr/bin/python2.6 distribute_setup.py
    

    刚刚安装新的操作系统(Lion OSX)后,我遇到了同样的问题。 安装python并执行它

    sudo easy_install ipython
    ipython
    

    我得到以下错误:

    Traceback (most recent call last):
      File "/usr/local/bin/ipython", line 8, in <module>
        load_entry_point('ipython==0.10.2', 'console_scripts', 'ipython')()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 318, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2220, in load_entry_point
        raise ImportError("Entry point %r not found" % ((group,name),))
    ImportError: Entry point ('console_scripts', 'ipython') not found
    

    然后我意识到这是一个许可问题。 如果我以sudo的方式执行ipython脚本。

    sudo ipython
    

    所以我将所有权从根目录更改为文件夹/Library/Python/2.7/site-packages/的用户()

    sudo chown -R <your_user>:wheel /Library/Python/2.7/site-packages/
    

    仅当您没有多个使用python的帐户时才使用更改所有权。

    我希望它适合你。

    最好

    链接地址: http://www.djcxy.com/p/26391.html

    上一篇: install not working on my Mac?

    下一篇: Installing Python packages from local file system folder with pip