使用pip或来自repos的easy_install进行Python软件包安装 [英] Python package install using pip or easy_install from repos

查看:74
本文介绍了使用pip或来自repos的easy_install进行Python软件包安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,对我而言,处理python软件包安装的最简单方法是从源代码管理系统中检出源代码,然后在python dist-packages文件夹中添加符号链接.

The simplest way to deal with python package installations, so far, to me, has been to check out the source from the source control system and then add a symbolic link in the python dist-packages folder.

很明显,由于源代码控制提供了降级,升级到任何分支,标记的完整控制,因此效果很好.

Clearly since source control provides the complete control to downgrade, upgrade to any branch, tag, it works very well.

有一种方法可以使用其中一种Package安装程序(easy_install或pip或其他),一个可以实现相同的目的.

Is there a way using one of the Package installers (easy_install or pip or other), one can achieve the same.

easy_install获取tar.gz并使用setup.py install进行安装,该安装程序安装在python2.6的dist-packages文件夹中.有没有办法配置它,或者使用pip来使用源代码版本控制系统(SVN/GIT/Hg/Bzr).

easy_install obtains the tar.gz and install them using the setup.py install which installs in the dist-packages folder in python2.6. Is there a way to configure it, or pip to use the source version control system (SVN/GIT/Hg/Bzr) instead.

推荐答案

使用 pip 这很容易.例如:

pip install -e hg+http://bitbucket.org/andrewgodwin/south/#egg=South

Pip将自动克隆源存储库并运行"setup.py development",以将其安装到您的环境中(希望它是 virtualenv ). Git,Subversion,Bazaar和Mercurial均受支持.

Pip will automatically clone the source repo and run "setup.py develop" for you to install it into your environment (which hopefully is a virtualenv). Git, Subversion, Bazaar and Mercurial are all supported.

然后,您还可以运行"pip Frozen",它将输出当前安装的软件包的列表以及它们的确切版本(对于开发安装,包括来自VCS的确切版本).您可以将其直接放入需求文件中,然后再运行

You can also then run "pip freeze" and it will output a list of your currently-installed packages with their exact versions (including, for develop-installs, the exact revision from the VCS). You can put this straight into a requirements file and later run

pip install -r requirements.txt

以完全相同的版本安装同一套软件包.

to install that same set of packages at the exact same versions.

这篇关于使用pip或来自repos的easy_install进行Python软件包安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆