Virtualenv can be installed using pip
:
pip3 install virtualenv
If this approach fails, try:
pip3 install --user virtualenv
Make a project directory (for example my_project
), and cd
into it.
mkdir my_project
cd my_project
Create a virtual environment in a current directory using virtualenv
command:
virtualenv .
If this does not work, or if it sets up virtualenv
for Python 2.x, you can run virtualenv
module as a script:
python3 -m virtualenv .
This should set up virtual environment in a current directory.
To start working in virtual environment, from the root of your project directory (i.e. top level domain directory) type:
source bin/activate
That's it! Now you can install packages in this environment using pip
, for example:
pip3 install django
When you're done working within virtual environment, deactivate it by typing:
deactivate
Done!