If you have already installed virtualenv as follows:
pip install virtualenv
Then you want to configure a specific virtualenv folder:
virtualenv [your project folder name]
This will create this project folder with several important subdirectories.
First, you activate your virtual server before installing anything new, the newly installed modules will be available to you only if you are "connected" to your virtual computer. In your project folder:
source bin/activate
You will then see your virtualenv name in brackets on each end line. This means that you are 'sourced' in. NOW install stuff with pip or easy_install.
pip install flask
virtualenv basically sets your search path in the [venv folder] / bin for executables instead of / usr / local / bin or whatever. Thus, you can copy files directly to the virtual env bin folder. (MongoDB files, for example, are included in the zip / tar file, you can simply unzip them to your folder in venv bin, and you will have access to this particular version of MongoDB when there is a "source".) Try it yourself, run this command from your virtual and then standard by default to see how it changes.
echo $PATH && echo $PYTHONPATH
To exit your virtualenv:
deactivate
By entering this, you will be returned to your default environment.
If you have not read this yet, this is a pretty good resource.
https://python-guide.readthedocs.org/en/latest/dev/virtualenvs/
Rob carpenter
source share