1

there are lots of packages related to python on my system, and they correspondent to different versions of python.

I think the best practice should not keep so much versions of python, but i have to, since the dependencies on linux is a bit sophisticated.

so is there any suggestions on how to keep a clean develop environment when programming python?

The details related to python in my system is as follows:

python
python            python2.4         python2.6         python_bk_24
python2           python26          python2.6-config


[mirror@home project]$ rpm -qa | grep python
python-sqlite-1.1.7-1.2.1
python-setuptools-0.6c5-2.el5
python-pip-0.8-1.el5
dbus-python-0.70-9.el5_4
python-elementtree-1.2.6-5
python-iniparse-0.2.3-4.el5
rpm-python-4.4.2.3-9.el5
libselinux-python-1.33.4-5.7.el5
python-libs-2.4.3-46.el5_8.2
python-devel-2.4.3-46.el5_8.2
ipython-0.8.4-1.el5
audit-libs-python-1.7.7-6.el5_3.3
python-urlgrabber-3.1.0-5.el5
python26-2.6.8-1.el5
python-2.4.3-46.el5_8.2
python26-distribute-0.6.10-4.el5
python26-virtualenv-1.5.1-3.el5
python26-libs-2.6.8-1.el5
python26-devel-2.6.8-1.el5
python-virtualenv-1.7-1.el5
libxml2-python-2.6.26-2.1.15.el5_8.2


[mirror@home project]$ python -V
Python 2.4.3
James McMahon
  • 48,506
  • 64
  • 207
  • 283
hugemeow
  • 7,777
  • 13
  • 50
  • 63

2 Answers2

4

Use virtual environments, through the virtualenv and virtualenvwrapper packages. These let you create clean workspaces that are separate for your individual projects. Using these workspaces goes something like:

mkvirtualenv project1
workon project1
# you are now in the virtual environment for project1- Python packages you
# install (such as with pip) will be installed only in this environment
deactivate project1

A good tutorial is here.

David Robinson
  • 77,383
  • 16
  • 167
  • 187
2

If you want to manage multiple versions of Python and different sets of Pip packages, I recommend tying out PythonBrew.

Detailed instructions on usage is available on the Github site's README.

It is similar to RVM for Ruby and comes with builtin virtualenv support.

James McMahon
  • 48,506
  • 64
  • 207
  • 283