program story

내 Mac에서 Python easy_install이 작동하지 않는 이유는 무엇입니까?

inputbox 2020. 12. 6. 21:30
반응형

내 Mac에서 Python easy_install이 작동하지 않는 이유는 무엇입니까?


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 설정을 복원하는 방법이 궁금합니다.


  1. easy_install 설치를 위해 / usr / bin 및 / usr / local / bin을 확인하고 이전 스크립트를 제거하십시오.

    sudo rm -f /usr/bin/easy_install*
    sudo rm -f /usr/local/bin/easy_install*
    
  2. 배포 다운로드 및 실행 :

    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. 다시 시도하고 즐기십시오. 예 :

    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)를 설치 한 직후에도 같은 문제가 발생했습니다. 파이썬을 설치하고 실행 한 후

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

그런 다음 권한 문제라는 것을 깨달았습니다. ipython 스크립트를 sudo로 실행하면 작동했습니다.

sudo ipython

그래서 소유권을 루트에서 /Library/Python/2.7/site-packages/ 폴더의 사용자 ()로 변경했습니다.

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

Python을 사용하는 계정이 여러 개없는 경우에만 소유권 변경을 사용하십시오.

나는 그것이 당신을 위해 일하기를 바랍니다.

베스트


setuptools 설치가 손상되었습니다. 디렉토리 easy_install-2.6스크립트는 Python 설치에서 /usr/bin실제 easy_install모듈 을로드하는 래퍼 일 뿐이며 후자는 누락되었습니다. 아마도 제거 pip하면 포인터가 손상 되거나 (일반적으로 디렉토리 .pth파일 형식 site-packages) 전체 패키지가 제거되었지만 /usr/bin/easy_install-2.6래퍼 스크립트 는 제거되지 않았습니다 .

가장 좋은 방법은 setuptools PyPI 페이지setuptools지침에 따라 처음부터 다시 설치 하는 것 입니다.


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.


I had a similar error message after following similar steps. I suspect it's because I tried to install the distribute module, and it tried to install a new version of setuptools which didn't quite work because it failed to correctly override the Mac OS X supplied setuptools. But that's only a suspicion.

I fixed my problem by doing the following. I found that the directory /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python had 4 files with .OLD in the name. When I did a compare with similarly named files without the .OLD from when things worked (via Time Machine) I found that they were the same except for the name. So I did the following renames:

setuptools.OLD.1305936263.57 -> setuptools
setuptools-0.6c9-py2.6.egg-info.OLD.1305936263.57 -> setuptools-0.6c9-py2.6.egg-info
pkg_resources.py.OLD.1305936263.57 -> pkg_resources
site.py.OLD.1305936263.59 -> site.py

I had to use the command line and sudo mv because the files are owned by root. For example: sudo mv setuptools.OLD.1305936263.57 setuptools. You'll have to enter your password.

The other thing I did was clean the /Library/Python/2.6/site-packages directory. I used Time Machine to set it back to its pre-messed up state. If you don't have Time Machine, then you should be able to recover if you delete any files or folders beginning with distribute, easy-install, pip, pkg_resources, setuptools and site.

If that doesn't do the trick, uninstall any modules you can from that directory. For example use pip uninstall if you installed modules with pip. The reason to do this is that installation can copy files into usr/local/bin and other places that pip will remove for you.

Next it's time to remove any remaining modules. Rename the folder (in case there's something you want later) and make a new empty one.

Reinstall the modules you want and with a little luck you're back in business...


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 :-)

참고URL : https://stackoverflow.com/questions/6012246/why-is-python-easy-install-not-working-on-my-mac

반응형