Reputation: 285
I have installed virtualenv for python. After I have installed some packages such as "nose" etc., I decided to have a try at installing some other packages without affect the former environment. I type the command,
virtualenv --system-site-packages --always-copy some_new_env
And it responded,
New python executable in some_new_env\Scripts\python.exe Installing setuptools, pip...done.
Then I looked into the folder some_new_env\lib\site-packages\, in it, still only with the following files and folders:
<_markerlib>
<pip>
<pip-1.5.6.dist-info>
<setuptools>
<setuptools-3.6.dist-info>
easy_install.py
easy_install.pyc
pkg_resources.py
pkg_resources.pyc
Nose etc. installed packages are not installed to this folder. Was the typed command incorrect? How should I type a right command to make those packages installed in the out environment copied to the new environment?
Upvotes: 3
Views: 704
Reputation: 23322
Ideally, you should not copy virtualenvs - instead, you should track the packages you need and install them in the new virtualenv.
This is made much easier if you use pip
:
$ env1/bin/pip freeze > requirements.txt
$ env2/bin/pip install -r requirements.txt
As a bonus, you can check requirements.txt
into source control, so that you always know what packages you need to install to get a certain version to work.
Here's the relevant documentation for pip freeze
Upvotes: 7