尝试使用easy_install或PIP安装任何内容时出现pkg_resources错误

时间:2014-02-15 14:58:49

标签: python setuptools easy-install pkg-resources

当在python IDE中打印pkg_resources所在的位置时,它打印出这个

>>> import pkg_resources
>>> print pkg_resources.__file__
/Library/Python/2.7/site-packages/setuptools-2.1-py2.7.egg/pkg_resources.pyc

但是当我尝试导航到.egg目录时,我收到错误

$ll setuptools-2.1-py2.7.egg/
ls: setuptools-2.1-py2.7.egg/: Not a directory

当我尝试使用easy_install或尝试使用PIP安装软件包或模块时。 我收到以下错误

$ sudo easy_install cython
Password:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
  File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 2701, in <module>
  File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 572, in resolve
pkg_resources.DistributionNotFound: setuptools==0.8b2

由于上述问题,我无法运行pylint

这是我的python路径中的路径:

>>> for each in sys.path: print each
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/bdist_mpkg-0.5.0-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/howdoi-1.1.5-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests_cache-0.4.4-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/requests-2.1.0-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Pygments-1.6-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pyquery-1.2.8-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/cssselect-0.9.1-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.7.3-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/GitPython-0.3.2.RC1-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gitdb-0.5.4-py2.7-macosx-10.6-intel.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/smmap-0.8.2-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/async-0.6.1-py2.7-macosx-10.6-intel.egg
/Library/Python/2.7/site-packages/ExifRead-1.4.2-py2.7.egg
/Library/Python/2.7/site-packages/ansi2html-1.0.6-py2.7.egg
/Library/Python/2.7/site-packages/six-1.5.2-py2.7.egg
/Library/Python/2.7/site-packages/distribute-0.7.3-py2.7.egg
/Library/Python/2.7/site-packages/setuptools-2.1-py2.7.egg
/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/Users/sanjeevkumar/Library/Python/2.7/lib/python/site-packages
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
/Library/Python/2.7/site-packages

重新安装setuptools python 2.6 2.7 现在我在尝试运行时遇到此错误cython

 $cython
Traceback (most recent call last):
  File "/usr/local/bin/cython", line 5, in <module>
    from pkg_resources import load_entry_point
  File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 2716, in <module>

  File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 685, in require
    def __getstate__(self):
  File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 588, in resolve
    The `plugin_env` should be an ``Environment`` instance that contains
pkg_resources.DistributionNotFound: Cython==0.20.1

0 个答案:

没有答案