【发布时间】:2011-04-30 06:59:38
【问题描述】:
在 Windows XP 上安装 Python 2.7 后,然后手动将 %PATH% 设置为 python.exe(为什么 python 安装程序不这样做?),然后安装 setuptools 0.6c11(为什么 python 安装程序不这样做) ?),然后手动将%PATH%设置为easy_install.exe(为什么安装程序不这样做?),我终于尝试使用easy_install安装python包,但是easy_install在无法安装时失败pywin32 包,这是一个依赖项。 如何让 easy_install 在 Windows XP 上正常工作?失败如下:
C:\>easy_install winpexpect
正在搜索 winpexpect
最佳匹配:winpexpect 1.4
处理winpexpect-1.4-py2.7.egg
winpexpect 1.4 已经是 easy-install.pth 中的活动版本
使用 c:\python27\lib\site-packages\winpexpect-1.4-py2.7.egg
处理 winpexpect 的依赖关系
搜索 pywin32>=214
阅读 http://pypi.python.org/simple/pywin32/
阅读 http://sf.net/projects/pywin32
阅读 http://sourceforge.net/project/showfiles.php?group_id=78018
找不到 pywin32>=214 的本地包或下载链接
最佳匹配:无
回溯(最近一次通话最后):
文件“C:\python27\scripts\easy_install-script.py”,第 8 行,在
load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install')()
文件“C:\python27\lib\site-packages\setuptools\command\easy_install.py”,第 1712 行,在 main
with_ei_usage(lambda:
文件“C:\python27\lib\site-packages\setuptools\command\easy_install.py”,第 1700 行,在 with_ei_usage
返回 f()
文件“C:\python27\lib\site-packages\setuptools\command\easy_install.py”,第 1716 行,在
distclass=DistributionWithoutHelpCommands, **kw
文件“C:\python27\lib\distutils\core.py”,第 152 行,在设置中
dist.run_commands()
文件“C:\python27\lib\distutils\dist.py”,第 953 行,在 run_commands
self.run_command(cmd)
文件“C:\python27\lib\distutils\dist.py”,第 972 行,在 run_command
cmd_obj.run()
运行中的文件“C:\python27\lib\site-packages\setuptools\command\easy_install.py”,第 211 行
self.easy_install(规范,不是 self.no_deps)
文件“C:\python27\lib\site-packages\setuptools\command\easy_install.py”,第 446 行,在 easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
文件“C:\python27\lib\site-packages\setuptools\command\easy_install.py”,第 481 行,在 install_item
self.process_distribution(spec, dists[0], deps, "使用")
文件“C:\python27\lib\site-packages\setuptools\command\easy_install.py”,第 519 行,在 process_distribution
[要求]、self.local_index、self.easy_install
解析中的文件“C:\python27\lib\site-packages\pkg_resources.py”,第 563 行
dist = best[req.key] = env.best_match(req, self, installer)
文件“C:\python27\lib\site-packages\pkg_resources.py”,第 799 行,在 best_match
return self.obtain(req, installer) # 尝试下载/安装
文件“C:\python27\lib\site-packages\pkg_resources.py”,第 811 行,在获取
返回安装程序(要求)
文件“C:\python27\lib\site-packages\setuptools\command\easy_install.py”,第 434 行,在 easy_install
self.local_index
文件“C:\python27\lib\site-packages\setuptools\package_index.py”,第 475 行,在 fetch_distribution
返回 dist.clone(location=self.download(dist.location, tmpdir))
AttributeError:“NoneType”对象没有属性“克隆”
【问题讨论】:
-
@Rafe:这对他一点帮助都没有。
-
@Sergio Tapia:只是一个建议。
-
要回答上面的一个问题,Python 安装程序不会修改您的 PATH 变量,因为 1) 它无法在卸载时正确修改 PATH,以及 2) 您可以在同一个上拥有多个 Python 版本系统,这可能会导致意外行为。见bugs.python.org/issue3561
-
为什么 setuptools 不是标准 Python 发行版的一部分,请参阅 faassen.n--tree.net/blog/view/weblog/2009/11/09/0
-
布兰登:感谢您的意见。我知道这是一个有点切题的讨论,我不得不说,当你做出艰难的决定时,比如是否设置 PATH 或预加载哪个包管理器,最好的办法是给用户无论如何,他们可能想要做的事情的选项。示例:“将python添加到路径?如果你不知道这是什么意思,请选择yes。[yes] [no]” ... “安装setuptools并设置他们的路径?如果你不知道这是什么意思,请选择是的。[是] [否]”。这不是一个完美的解决方案,但它比将新手派往谷歌要好得多。
标签: python windows easy-install