Create a Virtual Environment

Quick guide on how to create a virtual environment in Python

Here are the commands to create a virtual environment in Python:

python3 -m venv myvenv

After than, you can do:

source myvenv/bin/activate

On Ubuntu, sometimes (very rarely) you need to do this:

python3 -m venv --without-pip myvenv

After than, you can do:

source myvenv/bin/activate

Install packages

please check pip path first:

which pip

If your pip path is within the virtual environment, then you can do

pip install

If not, please run

python -m pip install