Forked from swedishmike/gist:902fb27d627313c31a95e31c44e302ac
Last active
July 13, 2024 08:04
-
-
Save anak10thn/77f8909a31c8d24e921f53177d718889 to your computer and use it in GitHub Desktop.
Adding and removing virtual environments to Jupyter notebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/anaconda/nb_conda_kernels | |
## Create the virtual environment | |
conda create -n 'environment_name' python=3.9 | |
## Activate the virtual environment | |
conda activate 'environment_name' | |
## Make sure that ipykernel is installed | |
pip install --user ipykernel | |
## Add the new virtual environment to Jupyter | |
python -m ipykernel install --user --name='environment_name' | |
## To list existing Jupyter virtual environments | |
jupyter kernelspec list | |
## To list existing conda environments | |
conda env list | |
## To remove conda environment | |
conda env remove -n 'environment_name' | |
## To remove the environment from Jupyter | |
jupyter kernelspec uninstall 'environment_name' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment