pip是easyinstall的替代品。但是我应该在Windows上使用easy_install安装pip吗?有更好的方法吗?


当前回答

我在Windows上使用来自continuum.io的跨平台Anaconda软件包管理器,它非常可靠。它具有虚拟环境管理和一个具有通用实用程序(例如conda、pip)的全功能外壳。

> conda install <package>               # access distributed binaries

> pip install <package>                 # access PyPI packages 

conda还为具有非Python依赖关系的库提供了二进制文件,例如panda、numpy等。这在Windows上尤其有用,因为很难正确编译C依赖关系。

其他回答

下载脚本:https://raw.github.com/pypa/pip/master/contrib/get-pip.py将其保存在驱动器上,如C:\pip-script\get-pip.py从命令提示符导航到该路径并运行“python-get-pip.py”

导向链接:http://www.pip-installer.org/en/latest/installing.html#install-点

注意:确保像这样的脚本路径(C:\Python27\scripts)也添加了int%path%环境变量。

当我必须使用Windows时,我使用ActivePython,它会自动将所有内容添加到PATH中,并包含一个名为PyPM的包管理器,它提供二进制包管理,从而使安装包更快、更简单。

pip和easyinstall不是完全相同的东西,因此有些东西可以通过pip获得,但easyinstall,反之亦然。

我的建议是,您可以使用ActivePython社区版,不用担心在Windows上为Python设置所有内容会带来巨大的麻烦。然后,您可以使用pypm。

如果你想使用pip,你必须检查ActiveState安装程序中的PyPM选项。安装后,您只需注销并再次登录,pip将在命令行上可用,因为它包含在ActiveState安装程序PyPM选项中,并且安装程序已经为您设置了路径。PyPM也将可用,但您不必使用它。

如何安装pip:

下载并安装ActivePython打开命令提示符(CMD)键入pypm install pip

安装人员

我在这里为distribute和pip构建了Windows安装程序(目标是使用pip,而不必使用easy_install进行引导或保存并运行Python脚本):

分发-0.6.27.win32.exepip-1.1.win32.exe

在Windows上,只需先下载并安装distribute,然后从上述链接下载pip。上面的分发链接确实包含stub.exe安装程序,这些安装程序目前仅为32位。我还没有在64位Windows上测试效果。

在Windows上构建

为新版本重做此操作的过程并不困难,我已将其包含在此处以供参考。

建筑物分布

为了获得存根.exe文件,您需要有一个Visual C++编译器(它显然也可以与MinGW兼容)

hg clone https://bitbucket.org/tarek/distribute
cd distribute
hg checkout 0.6.27
rem optionally, comment out tag_build and tag_svn_revision in setup.cfg
msvc-build-launcher.cmd
python setup.py bdist_win32
cd ..
echo build is in distribute\dist

建筑管道

git clone https://github.com/pypa/pip.git
cd pip
git checkout 1.1
python setup.py bdist_win32
cd ..
echo build is in pip\dist

到目前为止,我找到的最好的方法就是两行代码:

curl http://python-distribute.org/distribute_setup.py | python
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

它在Windows 8上使用PowerShell、Cmd和Git Bash(MinGW)进行了测试。

您可能希望将路径添加到环境中。它类似于C:\Python33\Scripts。