在Windows 7 64位中设置pip
我在 Python 2.7
上安装了 easy_install
和 setuptools
。但是在用 easy_install pip
安装 pip
的时候遇到了很多麻烦。我查了很多 StackOverflow 的帖子和博客,但还是没有解决问题。
以下是我在 Windows 的 cmd
中收到的错误信息:
Searching for pip
Reading http://pypi.python.org/simple/pip/
Download error: [Errno 10061] No connection could be made because the target mac
hine actively refused it -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
Download error: [Errno 10061] No connection could be made because the target mac
hine actively refused it -- Some packages may not be found!
No local packages or download links found for pip
Best match: None
Traceback (most recent call last):
File "C:\Python27\Scripts\easy_install-script.py", line 8, in <module>
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 <lambda>
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
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'
3 个回答
我去了一下 https://pypi.python.org/pypi/pip,那里有一个可以下载的压缩包。 下载完之后,只需在你的 Python\Scripts 文件夹里打开命令提示符,运行 "easy_install pip-1.3.1.tar.gz"。 看起来这样就能搞定了。 希望这对你有帮助。
我在用Windows 7 x64系统。
Installing Python 2.7
https://www.python.org/download/releases/2.7.2 --------Windows x86 MSI安装程序 (2.7.2) (签名)
安装好Python 2.7后(我默认安装在c:\python27),你就准备好了。
**Installing PIP:**
下载文件get-pip.py
https://raw.github.com/pypa/pip/master/contrib/get-pip.py
把它保存到一个你知道的文件夹:c:\pip\
打开Windows - 运行 - 输入cmd.exe
在cmd.exe里输入:
cd c:\python27(或者你安装Python的路径)
你会看到:
c:\python27
现在输入(记得你保存get-pip.py的路径,这里是c:\pip):
c:\python27\ python.exe c:\pip\get-pip.py
Pip就会被安装了。
Using Pip to Install Django
现在Python和Pip都安装好了,打开Windows - 运行 - 输入cmd.exe
在cmd.exe里输入:
cd c:\python27
你会看到:
c:\python27
现在输入:
python.exe -m pip install xxxxxxx
Pip会安装你想要的xxxxxx包。
举个例子: pip install Django==1.6.2
注意:这个指南是给完全新手的Python和Windows用户。
祝好
erick.alfaro@adtein.com www.adtein.com
我觉得在你尝试的过程中,你的Python环境可能搞乱了。虽然我相信你可以通过从python.org下载的CPython安装程序让它正常工作(我和很多人都是这样做的),但我强烈建议你重新开始(把现在的环境干净利落地删除),然后安装一些功能更全的Python版本,比如:
这些版本自带了很多额外的包,包括pip。它们的安装程序还会正确设置你的Windows PATH。所以,安装完成后,你可以直接打开 cmd.exe
,然后运行 python
或者 pip install ...
。
EPD的免费版本可以在这里找到。我自己对EPD和Python(x,y)的使用体验都很好。这里有一个列表,列出了标准的Python(x,y)安装程序带来的“插件”。需要注意的是,对于Windows,EPD和Python(x,y)都只有32位版本可用……不过,ActivePython的64位版本是免费的(PyPM的64位包不是免费的)。根据你的需求,这可能不是个问题。