使用Python setuptools.command.sdist导入错误

时间:2014-12-30 21:33:05

标签: python pip setuptools importerror

我正在尝试安装Newspaper,它使用pip安装了一大堆依赖项。在安装许多依赖项的过程中,会出现此错误:

ImportError: <module 'setuptools.command.sdist' from '/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/sdist.pyc'> has no '_default_revctrl' attribute

无pip安装工作正常,但由于报纸的依赖数量很多,因此非常繁琐。任何人都可以帮我一把吗?

这里是一个错误实例的完整回溯:

Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/Pillow.egg-info
    writing pip-egg-info/Pillow.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/Pillow.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/Pillow.egg-info/dependency_links.txt
    writing pip-egg-info/Pillow.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/Pillow.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/Pillow.egg-info/dependency_links.txt
    writing manifest file 'pip-egg-info/Pillow.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-auItlo/Pillow/setup.py", line 757, in <module>
        zip_safe=True,
      File "/usr/lib/python2.6/distutils/core.py", line 152, in setup
        dist.run_commands()
      File "/usr/lib/python2.6/distutils/dist.py", line 975, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.6/distutils/dist.py", line 995, in run_command
        cmd_obj.run()
      File "<string>", line 15, in replacement_run
      File "/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/egg_info.py", line 206, in find_sources
        mm.run()
      File "/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/egg_info.py", line 290, in run
        self.add_defaults()
      File "/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/egg_info.py", line 322, in add_defaults
        rcfiles = list(walk_revctrl())
      File "/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/sdist.py", line 18, in walk_revctrl
        for item in ep.load()(dirname):
      File "/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/pkg_resources/__init__.py", line 2265, in load
        raise ImportError("%r has no %r attribute" % (entry, attr))
    ImportError: <module 'setuptools.command.sdist' from '/usr/local/lib/python2.6/dist-packages/setuptools-10.0.1-py2.6.egg/setuptools/command/sdist.pyc'> has no '_default_revctrl' attribute

3 个答案:

答案 0 :(得分:5)

这也可能是由于今天发布的setuptools发生了变化:

https://bitbucket.org/pypa/setuptools/issue/320/cannot-upgrade-to-1001

答案 1 :(得分:0)

运行easy_install为我解决了这个问题:

easy_install --upgrade setuptools

答案 2 :(得分:0)

使用pip升级setuptools可以解决这个问题:

sudo pip install --upgrade setuptools