[Python3] Beginner must know, venv
1 min readJun 21, 2019
This article is for python3 environment, go read this article for python2+
1- Init project
$ python3 -m venv projectName
3- To begin using the virtual environment, it needs to be activated
$ source projectName/bin/activate
4- Install packages as usual
$ pip install requests
Dependency management
requirements.txt
is alike package.json in Node.js to me (hope I am right)
$ pip freeze > requirements.txt
// pip install -r requirements.txt
Finished
5- Run the script
$ python main.py
6- Deactivate
$ deactivate
7- Installing Dependency
This is useful when we clone a project online (from github.com) without downloading dependency, but installing them all on your local machine.
$ pip install -r requirements.txt