python - How to get virtualenv to use dist-packages on Ubuntu? -


i know virtualenv, if not passed --no-site-packages argument when creating new virtual environment, link packages in /usr/local/lib/python2.7/site-packages (for python 2.7) newly-created virtual environment. on ubuntu 12.04 lts, have 3 locations python 2.7 packages can installed (using default, ubuntu-supplied python 2.7 installation):

  1. /usr/lib/python2.7/dist-packages: has global installation of ipython, scipy, numpy, matplotlib – packages find difficult , time-consuming install individually (and dependences) if not available via scipy stack.
  2. /usr/local/lib/python2.7/site-packages: empty, , think stay way on ubuntu unless install package source.
  3. /usr/local/lib/python2.7/dist-packages: has important local packages astronomy, notably related pyraf, stsci, etc., , extremely difficult , time-consuming install individually.

note global directory such /usr/lib/python2.7/site-packages not exist on system. note global installation of ipython, scipy, etc. lets me use packages on-the-fly without having source/activate virtual environment every time.

naturally, want use virtualenv create 1 virtual environment in user home directory source/activate future projects. however, virtual environment, while being created, link/copy of packages in locations (1) , (3) in list above. main reason don't want go through pip install process (if possible) re-install ipython, scipy, astro-packages, etc. (and maybe other) virtual environments.

here questions:

  1. is there way me specify virtualenv link/copy packages in these 2 dist-packages directories virtual environments created in future?
  2. when update global installation of scipy, ipython, etc. in 2 dist-packages directories, update/change packages virtual environment uses (and got during virtualenv creation)?
  3. if ever install package source on ubuntu, go in /usr/local/lib/python2.7/dist-packages, or /usr/local/lib/python2.7/site-packages?

thanks in advance help!

this might legitimate use of pythonpath - environmental variable virtualenv doesn't touch, uses same syntax environmental variable path, in bash pythonpath=/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages in .bashrc or similar. if followed path,

  1. you don't have tell virtual environment @ all, won't try change it.

  2. no relinking required, and

  3. that still go wherever have gone (pip install uses /usr/local/lib/python2.7/dist-packages/ ubuntu) if install them outside of virtual environment. if install them within virtual environment (while it's activated) of course it'll put in virtualenvironment.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -