Python virtualenv
virtualenv
is a way to logically separate the computer environment you’re working inside of, so that other libraries or configurations don’t interfere with the current python project.
Instal virtualenv
pip install virtualenv
Install python virtualenv
with python3
I always want to use python3
these days because it is supported and some tools don’t work with python2.7
.
virtualenv --python python3 venv
virtualenv
= command--python python3
= initialize with python3venv
= name of the virtualenv (can be anything, but I always use “venv”)
. venv/bin/activate
- Activate the virtual environment (alternatively, could use
source venv/bin/activate
, but I like.
b/c it is shorter)
- Activate the virtual environment (alternatively, could use
Install venv
with python3
https://stackoverflow.com/questions/58336300/creating-virtualenv-with-python3
python3 -m venv venv
To use python3.9
instead of the default:
python3.9 -m venv venv
Graph:
- 108.40.10 Data Analysis - Working environment to 121.001 Python - Python virtualenv
- 108.40.10.30 Data Analysis - Data science computing infrastructure to 121.001 Python - Python virtualenv
- 108.40.20.40.10 Data Analysis - Install Jupyter Notebook locally to 121.001 Python - Python virtualenv
- 121 Python to 121.001 Python - Python virtualenv