CPython Jython IronPython PyPy
- computers come with multiple versions of standard CPython pre-installed.
$python --version
python3 --version
python3 -m venv myenv
-
here myenv is the name of virtual environment, we can give any name.
-
Then activate the virtual environment
source myenv/bin/activate
#After this command, virtual env should start reflecting in
#terminal like this
# (myenv) at the leftmost corner
- Deactivating a virtual environment:
deactivate
- before this upgrade pip using following command:
pip install --upgrade pip
- After this install requirements from requirements.txt file:
- make sure your virtual env is activated.
pip install -r requirements.txt
- here -r is for recursive.
Once requirements are installed, we are good to go.
-
on the go if we change requirements or add new dependencies we need to keep modifying this file.
-
we can generate this file from venv directly using following command:
pip freeze > requirements.txt
- make sure venv is active so that dependencies are being picked from there only rather than global python packages.