python - 如何在 Windows 上使用 Python 的 "easy_install"... 没那么容易

标签 python windows easy-install

在 Windows XP 上安装 Python 2.7 后,然后手动将 %PATH% 设置为 python.exe(为什么 python 安装程序不这样做?),然后安装 setuptools 0.6c11 (为什么 python 安装程序不这样做?),然后手动将 %PATH% 设置为 easy_install.exe (安装程序为什么不这样做是一个依赖。 如何让 easy_install 在 Windows XP 上正常工作?失败如下:

C:\>easy_install winpexpect
Searching for winpexpect
Best match: winpexpect 1.4
Processing winpexpect-1.4-py2.7.egg
winpexpect 1.4 is already the active version in easy-install.pth

Using c:\python27\lib\site-packages\winpexpect-1.4-py2.7.egg
Processing dependencies for winpexpect
Searching for pywin32>=214
Reading http://pypi.python.org/simple/pywin32/
Reading http://sf.net/projects/pywin32
Reading http://sourceforge.net/project/showfiles.php?group_id=78018
No local packages or download links found for pywin32>=214
Best match: None
Traceback (most recent call last):
  File "C:\python27\scripts\easy_install-script.py", line 8, in 
    load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
  File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 1712, in main
    with_ei_usage(lambda:
  File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 1700, in with_ei_usage
    return f()
  File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 1716, in 
    distclass=DistributionWithoutHelpCommands, **kw
  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:\python27\lib\site-packages\setuptools\command\easy_install.py", line 211, in run
    self.easy_install(spec, not self.no_deps)
  File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 446, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 481, in install_item
    self.process_distribution(spec, dists[0], deps, "Using")
  File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 519, in process_distribution
    [requirement], self.local_index, self.easy_install
  File "C:\python27\lib\site-packages\pkg_resources.py", line 563, in resolve
    dist = best[req.key] = env.best_match(req, self, installer)
  File "C:\python27\lib\site-packages\pkg_resources.py", line 799, in best_match
    return self.obtain(req, installer) # try and download/install
  File "C:\python27\lib\site-packages\pkg_resources.py", line 811, in obtain
    return installer(requirement)
  File "C:\python27\lib\site-packages\setuptools\command\easy_install.py", line 434, in easy_install
    self.local_index
  File "C:\python27\lib\site-packages\setuptools\package_index.py", line 475, in fetch_distribution
    return dist.clone(location=self.download(dist.location, tmpdir))
AttributeError: 'NoneType' object has no attribute 'clone'

最佳答案

如果您使用的是 windows 7 64 位版本,则可以在此处找到解决方案:http://pypi.python.org/pypi/setuptools

也就是说,你需要下载一个python脚本,运行它,然后easy_install就可以从命令行正常工作了。

附:我同意原始海报说这应该开箱即用。

关于python - 如何在 Windows 上使用 Python 的 "easy_install"... 没那么容易,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4016151/

相关文章:

python - 根据 Beautifulsoup 中的内容排除标签

python - 从数据存储检索图像时出现此错误

windows - SQL加: how to change directory and show current working directory

windows - easy_install M2Crypto 在 Windows 平台上失败

python - APScheduler 执行后立即退出

python - C 扩展中用于 IO 有界线程的 GIL (HDF5)

windows - Psexec 和 UAC 问题

c++ - 系统托盘上下文菜单空白

python - 将默认 python 安装从 2.6 迁移到 2.7 : problems with easy_install

python - 使用easy_install安装egg后,导入模块时出现ImportError