An environment can be created using conda (recommended for better management and ease of use) or venv
(comes with Python).
Create Environment: conda create --name myenv python=3.10
To run pip
and python
commands, the environment needs to be activated using the following command:
Activate: conda activate myenv
To exit an environment using the following command:
Deactivate: conda deactivate
Create Environment: python -m venv myenv
To run pip
and python
commands, the environment needs to be activated:
- Activate in MAC/Linux:
source myenv/bin/activate
- Activate in Windows:
myenv\Scripts\activate
Deactivate: deactivate
The environment can be used with notebook using the following steps:
- activate the environment in terminal
- do
pip install ipykernel
- do
python -m ipykernel install --user --name=kernel_name
- In the top menu bar, go to Kernel and choose Change Kernel. Select the newly created
kernel_name
.