如何在Windows上使用Python的"easy_install"......这并不容易

Nic*_*ick 62 python windows easy-install

在Windows XP上安装Python 2.7之后,然后手动设置%PATH%python.exe(为什么python安装程序不会这样做?),然后安装setuptools 0.6c11(为什么python安装程序不执行此操作?),然后手动设置%PATH%easy_install.exe(为什么没有?)安装程序执行此操作吗?),我终于尝试安装python包easy_install,但是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'

Gab*_*iel 23

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

即,你需要下载一个python脚本,运行它,然后easy_install将从命令行正常工作.

PS我同意原始海报说这应该是开箱即用的.


Bra*_*don 9

一个问题是easy_install被设置为下载和安装.egg文件或源发行版(包含在.tgz,.tar,.tar.gz,.tar.bz2或.zip文件中).它不知道如何处理PyWin32扩展,因为它们被放在一个单独的安装程序可执行文件中.您需要下载相应的PyWin32安装程序文件(适用于Python 2.7)并自行运行.当您再次运行easy_install时(如果您已正确安装它,就像在Sergio的说明中那样),您应该看到您的winpexpect软件包已正确安装.

由于我们正在谈论它的Windows和开源,它通常是安装方法的混乱组合,以使事情正常工作.但是,easy_install仍然比手动编辑配置文件更好.


Een*_*ble 9

我也同意OP,所有这些东西都应该在Python中设置.我想我们将不得不处理它直到那一天到来.这是一个实际上对我有用的解决方案:

安装easy_install更快更容易

我希望它可以帮助你或任何有同样问题的人!


小智 6

从以下URL复制以下脚本"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中

从Scripts目录>运行轻松安装

C:\ Python27\Scripts> easy_install