Dealing with virtualenv in python3
Published in
1 min readNov 19, 2018
Sometimes when programming in python we have version incompatibilities between projects.
In order to avoid that, we can build different environments depending on which versions of the libraries work on each project (or even have different python versions: one in python3.6 and another in python2.7).
MAC
- Install python [download]
- Install pip using
pip3 install virtualenv
or downloading it [here] - Go to the path where your environment will be placed:
cd enviroment/path/route
- Use
python3 -m virtualenv EnvName
to create the environment named EnvName insideenviroment/path/route
- Activate the environment
source EnvName/bin/activate
WINDOWS
- Install python [download]
- Install pip using
pip3 install virtualenv
or downloading it [here] - Go to the path where your environment will be placed:
cd enviroment/path/route
- Use
virtualenv EnvName
to create the environment named EnvName insideenviroment/path/route
. (Usevirtualenv --python=C:\absolute\path\of\the\python.exe EnvName
to select a specific python version) - Activate the enviroment
source EnvName/Scripts/activate
You can then use pip install -r requierements.txt
to install a requirements file.