如何在Ubuntu上正确安装多个非软件包Distribute/virtualenv/pip生态系统? [英] How can I correctly install multiple non-package Distribute/virtualenv/pip ecosystems on Ubuntu?

查看:113
本文介绍了如何在Ubuntu上正确安装多个非软件包Distribute/virtualenv/pip生态系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Ubuntu中开发Python应用程序.我想设置一个分布式/virtualenv/pip生态系统来独立于任何系统Python软件包(我在Synaptic中管理,或更确切地说,让系统由我自己管理)来独立管理我的Python软件包.

I am developing Python applications in Ubuntu. I want to setup a Distribute/virtualenv/pip ecosystem to manage my Python packages independently of any system Python packages (which I manage in Synaptic, or rather I let the system manage them for me).

我可以只安装python-setuptools,python-virtualenv和python-pip系统软件包,并以自己的方式运行,但我也希望能够获得最新/特定版本的Distribute,virtualenv和pip.这些没有PPA,因此我必须手动安装它们.

I could just install the python-setuptools, python-virtualenv and python-pip system packages and be on my merry way, but I also want to be able to get latest/specific versions of Distribute, virtualenv and pip. There are no PPAs for these, so I'll have to install them manually.

最后一个麻烦是,我希望能够对多个版本的Python执行此操作.也就是说,为python2.6建立一个生态系统,为python建立另一个生态系统,为python3建立另一个生态系统,或者在64位系统上为

A final complication, is that I want to be able to do this for multiple versions of Python. That is, set up one ecosystem for python2.6, another for python, another for python3, or on a 64-bit system another for chrooted 32-bit Python.

我猜测该过程将类似于:

I'm guessing that the process would be something like:

  • 使用Python X将自己的分发"副本安装到主文件夹中的某个位置
  • 使用独立分发,easy_install pip
  • 使用独立的pip,安装virtualenv
  • 使用独立的virtualenv,创建虚拟环境
  • 激活虚拟环境,安装软件包
  • 针对Python Y,Z和Q重复

我要寻找什么安装/配置选项?

What installation/configuration options am I looking for?

推荐答案

这些天,我对JF Sebastian和nealmcb的贡献进行了详细阐述,的确确实使用了

Elaborating on JF Sebastian and nealmcb's contributions, these days I do indeed use my system packaged version of virtualenvwrapper (available on Ubuntu 12.04 and later).

virtualenvwrapper是Ian Bicking的virtualenv工具的一组扩展.这些扩展包括用于创建和删除虚拟环境以及管理开发工作流的包装程序,从而使一次处理多个项目而不会在其依赖项中引入冲突的工作变得更加容易.

virtualenvwrapper is a set of extensions to Ian Bicking’s virtualenv tool. The extensions include wrappers for creating and deleting virtual environments and otherwise managing your development workflow, making it easier to work on more than one project at a time without introducing conflicts in their dependencies.

我使用的主要功能(回答此问题)是:

The key features I use (in answer to this question) are:

  • mkvirtualenv --python=PYTHON_EXE creates a virtualenv using a specific Python executable (doesn't have to be a system packaged version)
  • tie in to pip's virtualenv support
  • allvirtualenv pip install -U pip upgrades pip in all virtualenvs

提到的环境变量JFS确实非常有用:PIP_DOWNLOAD_CACHE,VIRTUALENV_USE_DISTRIBUTE,WORKON_HOME,VIRTUALENVWRAPPER_PYTHON.

The environment variables JFS mentioned are indeed useful to fiddle with: PIP_DOWNLOAD_CACHE, VIRTUALENV_USE_DISTRIBUTE, WORKON_HOME, VIRTUALENVWRAPPER_PYTHON.

更新virtualenv本身的唯一原因是获取最新版本的setuptools(以前称为Distribute,以前称为setuptools).我还没有这样做的必要,但是我怀疑首先从全新的virtualenv开始升级,然后先升级Distribute/setuptools,然后再升级pip,然后再安装其他库是最容易的.

The only reason to update virtualenv itself is to get the latest version of setuptools (previously known as Distribute, previously known as setuptools). I haven't had a need to do this yet, but I suspect it would be easiest to start with a fresh virtualenv and upgrade Distribute/setuptools first, then upgrade pip, then install other libraries.

如果严格需要新版本的virtualenv,则应该对引导脚本进行修改.

If a new version of virtualenv is strictly necessary, a modification of the bootstrap script should do.

这篇关于如何在Ubuntu上正确安装多个非软件包Distribute/virtualenv/pip生态系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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