Setting up virtual environment is great way to manage different projects accross python. As python programming language can be used across various domains virtual environment provides way to manage dependencies in standard way.
There are few important commands that can be used to activate virtual environment. We are using python3 so make sure python3 is installed on your system.
Installation of virtual environment across Various platforms
A. Ubuntu 16
$ sudo apt install python3-pip
$ pip3 install virtualenv
B. Ubuntu 17+
$ sudo apt-get install python3-venv
C. Fedora
Not Required (Already Installed)
Creating Virtual Environment
A. Ubuntu 16
$ virtualenv project_folder
B. Ubuntu 17+/Fedora
$ python3 -m venv project_folder
NOTE: if you are inside project folder you can use .
Starting Virtual Environment
You need to be inside project_folder to start/activate virtual environment.
$ source bin/activate
Stopping Virtual Environment
You need to be inside project_folder to start/activate virtual environment.
$ deactivate
Comments