ImportError : OS X에서 Python을 업그레이드 한 후 pkg_resources라는 모듈이없는 이유는 무엇입니까?
방금 Mac에서 Python을 2.6.4로 업데이트했습니다. dmg 패키지에서 설치했습니다.
바이너리가 Python 경로를 올바르게 설정하지 않은 것 같아서 다음을 추가 '/usr/local/lib/python2.6/site-packages'
했습니다..bash_profile
>>> pprint.pprint(sys.path)
['',
'/Users/Bryan/work/django-trunk',
'/usr/local/lib/python2.6/site-packages',
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
'/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages']
분명히 iPython을 실행할 수 없기 때문에 필요한 모든 경로는 아닙니다.
$ ipython
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named `pkg_resources`
Google 검색을 수행했지만 설치 방법을 알 수 pkg_resources
없거나 경로에 있는지 확인할 수 없습니다 .
이 문제를 해결하려면 어떻게해야합니까?
[업데이트] TL; DR pkg_resources
은 Distribute 또는 setuptools에서 제공 합니다.
[업데이트 2] PyCon 2013에서 발표 한대로 Distribute
및 setuptools
프로젝트가 다시 병합되었습니다. Distribute
이제 더 이상 사용되지 않으며 new current setuptools
. 이 시도:
curl -O https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python ez_setup.py
또는 더 나은, pip
높은 수준의 인터페이스로 전류 를 사용 setuptools
하고 커버 아래에서 사용할 것 입니다.
[OP의 특정 문제에 대한 긴 답변] :
귀하의 질문에 말하지 않지만 Apple에서 제공하는 Python (10.5에서 2.5 또는 10.6에서 2.6.1)에서 업그레이드했거나 python.org Python 2.5에서 업그레이드했다고 가정합니다. 이러한 경우에 중요한 점은 각 Python 인스턴스에 추가 패키지가 설치되는 자체 사이트 패키지 라이브러리를 포함하여 자체 라이브러리가 있다는 것입니다. (그리고 그들 중 어느 것도 /usr/local/lib
기본적으로 사용하지 않습니다 .) 즉, 새로운 파이썬 2.6에 필요한 추가 패키지를 설치해야합니다. 이를 수행하는 가장 쉬운 방법은 먼저 새 python2.6이 검색에 먼저 나타나는지 확인하는 $PATH
것입니다 (즉, 입력 python2.6
하면 예상대로 호출됩니다). python2.6 설치 프로그램은 .bash_profile
프레임 워크 bin 디렉토리를 $PATH
. 그런 다음 설치 easy_install
사용거기의 지침에 따라 setuptools . pkg_resources
모듈은 자동 공정에 의해 설치된다.
그런 다음 새로 설치된 버전 easy_install
(또는 pip
)을 사용하여 ipython
.
easy_install ipython
또는
pip install ipython
site-packages
해당 Python 인스턴스에 대한 올바른 위치에 자동으로 설치 되어야하며 이동하는 것이 좋습니다.
나는 같은 ImportError
. 어떻게 든 setuptools
내 Python 환경에서 패키지가 삭제되었습니다.
문제를 해결하려면 다음에 대한 설정 스크립트를 실행하십시오 setuptools
.
curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | python
당신이 어떤 버전이있는 경우 distribute
, 또는 setuptools
0.6 이하를, 먼저 설치 제거해야합니다. *
자세한 내용은 설치 지침 을 참조 하십시오.
* If you already have a working distribute
, upgrading it to the "compatibility wrapper" that switches you over to setuptools
is easier. But if things are already broken, don't try that.
In case of upgrading your python on mac os 10.7 and pkg_resources doesn't work, the simplest way to fix this is just reinstall setuptools as Ned mentioned above.
sudo pip install setuptools --upgrade
or sudo easy_install install setuptools --upgrade
On my system (OSX 10.6) that package is at
/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py
I hope that helps you figure out if it's missing or just not on your path.
The reason might be because the IPython module is not in your PYTHONPATH.
If you donwload IPython and then do python setup.py install
The setup doesn't add the module IPython to your python path. You might want to add it to your PYTHONPATH manually. It should work after you do :
export PYTHONPATH=/pathtoIPython:$PYTHONPATH
Add this line in your .bashrc or .profile to make it permanent.
I realize this is not related to OSX, but on an embedded system (Beagle Bone Angstrom) I had the exact same error message. Installing the following ipk packages solved it.
opkg install python-setuptools
opkg install python-pip
I got this error on Ubuntu, and the following worked for me:
Removed the dropbox binaries and download them again, by running:
sudo rm -rf /var/lib/dropbox/.dropbox-dist
dropbox start -i
I encountered with the same problem when i am working on autobahn related project.
1) So I download the setuptools.-0.9.8.tar.gz form https://pypi.python.org/packages/source/s/setuptools/ and extract it.
2 )Then i get the pkg_resources module and copy it to the folder where it needed. **in my case that folder was C:\Python27\Lib\site-packages\autobahn
In my case, package python-pygments
was missed. You can fix it by command:
sudo apt-get install python-pygments
If there is problem with pandoc
. You should install pandoc
and pandoc-citeproc
.
sudo apt-get install pandoc pandoc-citeproc
'development' 카테고리의 다른 글
SQL Server 2008 Management Studio에서 text 또는 varchar (MAX) 열의 전체 내용을 보려면 어떻게합니까? (0) | 2020.09.24 |
---|---|
std :: type_info :: name 결과 관리 해제 (0) | 2020.09.24 |
$ _SERVER [ 'REMOTE_ADDR']을 신뢰하는 것이 안전합니까? (0) | 2020.09.24 |
루프 중에 TextBox.Text에 추가하면 반복 할 때마다 더 많은 메모리를 차지하는 이유는 무엇입니까? (0) | 2020.09.24 |
Windows 스토어 앱에서 CoreDispatcher를 가져 오는 올바른 방법 (0) | 2020.09.24 |