2

I'm quite confused about the best way to define my Python installation paths. For some reason I use multiple versions of python with multiple versions of numpy, scipy and matplotlib, and with multiple versions of gcc.

For the moment, I use paths like /softs/python/2.7.6/numpy/1.8.0/scipy/0.13.3/matplotlib/1.3.1/64/gcc/4.7.2 but its quite complicated to identify the number of installed versions, for wich I have a 32-bit version, etc...

Is there a better common way to have multiple versions of packages in Python and manage the paths ?

Caduchon
  • 4,574
  • 4
  • 26
  • 67

1 Answers1

2

For changing python version you can use virtualenv.

Eg.Try this for python2,7,python3.3

pip install virtualenvwrapper
python_path = which(python2.7)
virtualenv -p python_path my_env
source /usr/local/bin/virtualenvwrapper.sh
workon my_env
python_path = which(python3.3)
virtualenv -p python_path my_env2
workon env2

Use this for activation virtualenv.

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh

You can also store the above commands in a file ~/.bashrc and run

source ~/.bashrc
workon env1
Prateek099
  • 549
  • 1
  • 5
  • 15
  • Can I easily obtain the absolute path to a python version managed by virtualenv ? I have to use it through CMake and compilation. I'm generally effraid by 'auto' path (modules for example). – Caduchon Feb 18 '15 at 11:36