Why is Python easy_install not working on my Mac?

后端 未结 7 637
甜味超标
甜味超标 2020-11-28 19:39

I have a Mac running Python 2.6. When I try to use easy_install I get this message:

/usr/bin/easy_install-2.6:7: UserWarning: Module pkg_resourc         


        
相关标签:
7条回答
  • 2020-11-28 20:26

    Your setuptools installation is broken. The easy_install-2.6 script in your /usr/bin directory, is only a wrapper that loads the actual easy_install module in your Python installation, and the latter is missing. Presumably uninstalling pip either broke the pointer to it (usually in the form of a .pth file in your site-packages directory) or removed the whole package but didn't remove the /usr/bin/easy_install-2.6 wrapper script.

    Your best bet is to re-install setuptools from scratch again, by following the instructions on the setuptools PyPI page.

    0 讨论(0)
  • 2020-11-28 20:26

    I had the same problem, I suspect caused by my installation of Homebrew which apparently installs its own version of easy_install blindly and screws up whatever you're currently running (enough times for homebrew to recognize it as a problem). I found my solution here Upgraded Python on Snowleopard Using Homebrew now pip and easy_install don't work

    While I'm actually on Lion, it still fixed my problem. You just download ez_setup.py from http://pypi.python.org/pypi/ez_setup - run ez_setup.py through terminal and you're off to the races.

    0 讨论(0)
  • 2020-11-28 20:27

    I had the same problem just after installing the new Operating System (Lion OSX). After install python and execute it

    sudo easy_install ipython
    ipython
    

    I got the following error:

    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
    

    Then I realize it was a permission problem. If I execute the ipython script as sudo it worked.

    sudo ipython
    

    So I changed the ownership from root to my user () of the folder /Library/Python/2.7/site-packages/

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

    Use change ownership only if you don't have several accounts that uses python.

    I hope it work for you.

    Best

    0 讨论(0)
  • 2020-11-28 20:30
    1. Check your /usr/bin and /usr/local/bin for easy_install installations and remove any old script:

      sudo rm -f /usr/bin/easy_install*
      sudo rm -f /usr/local/bin/easy_install*
      
    2. Download and run distribute:

      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
      
    3. Try again, and enjoy. E.g.:

      sudo easy_install pip
      
    0 讨论(0)
  • 2020-11-28 20:31

    I suspect the easiest way you can get easy_install working again is to install distribute, which is an improved version of distutils that bundles it's own version of easy_install. Installation is simple:

    curl -O http://python-distribute.org/distribute_setup.py
    /usr/bin/python2.6 distribute_setup.py
    
    0 讨论(0)
  • 2020-11-28 20:31

    Martijn Pieter's answer is correct.

    1. Go to http://pypi.python.org/pypi/setuptools#downloads
    2. Download setuptools-0.6c11-py2.7.egg
    3. From your downloads directory run: sudo ./setuptools-0.6c11-py2.7.egg

    Done :-)

    0 讨论(0)
提交回复
热议问题