Skip to content

Instantly share code, notes, and snippets.

@Fakesum
Created March 31, 2025 09:35
Show Gist options
  • Save Fakesum/82148fefb6ec081c3610368defec09e1 to your computer and use it in GitHub Desktop.
Save Fakesum/82148fefb6ec081c3610368defec09e1 to your computer and use it in GitHub Desktop.
Switch google Colab to 3.12.7
# Install Miniconda to manage environments
!wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
!bash Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local
import sys
sys.path.append('/usr/local/bin')
# Create a conda environment with Python 3.12.7
!conda create -n py312 python=3.12.7 -y
# Activate the environment and install ipykernel (to use as a Jupyter kernel)
!source activate py312 && pip install ipykernel
# Register the conda environment as a Jupyter kernel
!python -m ipykernel install --user --name py312 --display-name "Python 3.12.7"
# Refresh the runtime to see the new kernel (may require manual restart)
print("Installation complete! Go to 'Runtime > Change runtime type' and select the 'Python 3.12.7' kernel.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment