Last active
November 21, 2022 18:51
-
-
Save thumbarnirmal/25c6b232fe5a87c6eafc7da15b135210 to your computer and use it in GitHub Desktop.
Commands for initial Python environment setup
This file contains 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
# Install pip | |
sudo apt install python3-pip | |
# Install virtualenv using pip3 | |
sudo pip3 install virtualenv | |
# Create a virtual environment | |
virtualenv venv | |
# Create virtual environment for a specific Python interpreter version | |
virtualenv -p /usr/bin/python2.7 venv | |
# Active virtual environment | |
source venv/bin/activate | |
# Deactivate virtual environment | |
deactivate | |
# To use virtual environment as a notebook kernel | |
# From inside the virtual environment | |
pip install ipykernel | |
ipython kernel install --user --name=kernel_name | |
# If the notebook doesn't pick up the new kernel, use this instead of the previous command | |
python3 -m ipykernel install --user --name=kernel_name | |
# To list available kernels in jupyter | |
jupyter kernelspec list | |
# To remove a specific kernel from jupyter | |
jupyter kernelspec remove kernel_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment