安装setuptools windows 7时出现ZipImportError

时间:2014-04-12 19:11:53

标签: python windows setuptools

我想安装django框架,但我需要setuptools。我在stackoverflow上找到了同样的问题,但它似乎没有提供解决方案。 我使用官方installing instructions for setuptools on win7 但它没有完成,它说它已经安装,但它不完全(我无法在django \ setup.py中导入它)。由于它是一个帮助设置其他模块的模块,因此它无法自行安装。我收到这个错误:

Installed c:\python27\lib\site-packages\setuptools-3.4.4-py2.7.egg  # installed? i don't think so
Processing dependencies for setuptools==3.4.4
Traceback (most recent call last):
  File "setup.py", line 217, in <module>
    dist = setuptools.setup(**setup_params)
  File "C:\Python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\install.py", line 61, in run
    self.do_egg_install()
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\install.py", line 111, in do_egg_install
    cmd.run()
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\easy_install.py", line 358, in run
    self.easy_install(spec, not self.no_deps)
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\easy_install.py", line 574, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\easy_install.py", line 625, in install_item
    self.process_distribution(spec, dist, deps)
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\setuptools\c
ommand\easy_install.py", line 671, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 633, in resolve
    requirements.extend(dist.requires(req.extras)[::-1])
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 2291, in requires
    dm = self._dep_map
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 2277, in _dep_map
    for extra,reqs in split_sections(self._get_metadata(name)):
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 2715, in split_sections
    for line in yield_lines(s):
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 1989, in yield_lines
    for ss in strs:
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 2305, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 1369, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 1361, in get_metadata
    return self._get(self._fn(self.egg_info,name))
  File "c:\users\adam\appdata\local\temp\tmpbgu0fr\setuptools-3.4.4\pkg_resource
s.py", line 1425, in _get
    return self.loader.get_data(path)
zipimport.ZipImportError: bad local file header in c:\python27\lib\site-packages
\setuptools-3.4.4-py2.7.egg
Something went wrong during the installation.
See the error message above.

1 个答案:

答案 0 :(得分:0)

试用3.0版本https://pypi.python.org/packages/source/s/setuptools/setuptools-3.0.zip。当我遇到同样的问题时,它在我的Python v2.75上工作。