How to Set Up a Virtual Environment in Python
Virtual Environment?
Python's official documentation says:
"A virtual environment is a Python environment such that the Python interpreter, libraries and scripts installed into it are isolated from those installed in other virtual environments, and (by default) any libraries installed in a “system” Python, i.e., one which is installed as part of your operating system."
Ubuntu - Installation
Install
# sudo apt install python3-venv
Create an environment
# python3 -m venv my-project-env
Activate
# source my-project-env/bin/activate
Deactivate
# deactivate
Windows - Installation
Install
# pip install virtualenv
Create an environment
# virtualenv my-project-env
Activate
# my-project-env\Scripts\activate
Deactivate
# deactivate
Comments
Post a Comment