在Windows XP上安装Python 2.7后,然后手动将%PATH%
设置为python.exe
(为什么python安装程序不会这样做?),然后安装setuptools 0.6c11
(为什么没有' python安装程序执行此操作?),然后手动将%PATH%
设置为easy_install.exe
(安装程序为什么不执行此操作?),我终于尝试使用easy_install
安装python包,但是easy_install
在无法安装pywin32软件包时失败,这是一个依赖项。 如何在Windows XP上使easy_install正常工作?失败如下:
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'
答案 0 :(得分:23)
如果您使用的是Windows 7 64位版本,则可在此处找到解决方案:http://pypi.python.org/pypi/setuptools
即,您需要下载一个python脚本,运行它,然后easy_install将从命令行正常工作。
P.S。我同意原始的海报说这应该开箱即用。
答案 1 :(得分:9)
一个问题是easy_install设置为下载和安装.egg文件或源发行版(包含在.tgz,.tar,.tar.gz,.tar.bz2或.zip文件中)。它不知道如何处理PyWin32扩展,因为它们被放置within a separate installer executable。您需要下载相应的PyWin32安装程序文件(适用于Python 2.7)并自行运行。当您再次运行easy_install时(如果您已正确安装它,就像在Sergio的说明中那样),您应该看到您的winpexpect软件包已正确安装。
由于我们正在谈论的是Windows和开源,它通常是安装方法的混乱组合,以使事情正常工作。但是,easy_install仍然比手动编辑配置文件更好。
答案 2 :(得分:9)
我也同意OP,所有这些东西都应该在Python中设置。我想我们将不得不处理它直到那一天到来。这是一个实际上对我有用的解决方案:
installing easy_install faster and easier
我希望它可以帮助您或任何有同样问题的人!
答案 3 :(得分:6)
从以下网址
复制以下脚本“ez_setup.py”https://bootstrap.pypa.io/ez_setup.py
将其复制到Python位置
C:\ Python27>
运行命令
C:\ Python27? python ez_setup.py
这将在Scripts目录下安装easy_install
C:\ Python27 \脚本
从Scripts目录>
运行简易安装C:\ Python27 \脚本> easy_install
答案 4 :(得分:1)
首先,它说你已经安装了该模块。如果你需要升级它,你应该这样做:
easy_install -U packageName
当然,如果软件包有一些需要编译的C头并且您没有安装正确版本的Visual Studio,则easy_install不能很好地工作。您可以尝试使用pip或distribute而不是easy_install,看看它们是否更好。
答案 5 :(得分:0)