免费白嫖GoogleT4和T100——Colab 更换python版本

我们有时候根据具体任务,需要变动python版本,但Colab官方给出的解释是只有python2.7和python3.6可用,拜托,python3.9都出来啦,现在给出切换python3.8参考代码。

按照以下代码一步步执行即可:

#察看当前python 版本
!python -V
# install Anaconda3
!wget -qO ac.sh https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh 
!bash ./ac.sh -b
# a fake google.colab library
!ln -s /usr/local/lib/python3.6/dist-packages/google \
       /root/anaconda3/lib/python3.8/site-packages/google
# start jupyterlab, which now has Python3 = 3.8
!nohup /root/anaconda3/bin/jupyter-lab --ip=0.0.0.0&
# access through ngrok, click the link
!pip install pyngrok -q
from pyngrok import ngrok
print(ngrok.connect(8888))
import os
os.environ['PATH'] = '/root/anaconda3/bin:' + os.environ['PATH']
#察看更新后的python 版本
!python -V

参考stackoverflow:链接

你可能感兴趣的:(解决代码Error,python,anaconda,cuda,ubuntu)