在 osx 10.6 上使用 easy_install 时遇到问题

在 osx 10.6 上使用 easy_install 时遇到问题

我已经在 Google 上搜索过一些内容,但没有找到任何结果。

输出如下

$ easy_install yolk
'import site' failed; use -v for traceback
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 get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 2174, in load_entry_point
  return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 1907, in load
  entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/setuptools/__init__.py", line 2, in <module>
  from setuptools.extension import Extension, Library
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/setuptools/extension.py", line 2, in <module>
  from dist import _get_unpatched
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/setuptools/dist.py", line 5, in <module>
  from setuptools.command.install import install
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/setuptools/command/install.py", line 2, in <module>
  from distutils.command.install import install as _install
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/command/install.py", line 21, in <module>
  from site import USER_BASE
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.py", line 516, in <module>
    main()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.py", line 499, in main
known_paths = addsitepackages(known_paths)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.py", line 291, in addsitepackages
  addsitedir(sitedir, known_paths)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.py", line 185, in addsitedir
  addpackage(sitedir, name, known_paths)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site.py", line 155, in addpackage
  exec line
File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute '__plen'

有任何想法吗?

答案1

似乎你有一个损坏的easy-install.pth。最简单的修复方法是将其删除;在终端中运行:

sudo rm /Library/Python/2.6/site-packages/easy-install.pth

然而,这会产生副作用,即您必须重新安装已使用 安装的软件包easy_install

顺便说一下,尝试一下点子- 它没那么糟糕。

pip 是一个用于安装和管理 Python 包的工具,例如在 Python 包索引中找到的包。

pip 是 easy_install 的替代品。它主要使用相同的技术来查找包,因此 easy_installable 的包也应该可以通过 pip 安装。这意味着您可以使用 pip install SomePackage 而不是 easy_install SomePackage。

相关内容