I have a code which works in python3.5 but will throw errors in python>3.5
but with
!python --version
in google colab return python 3.6.9, is there any way I can force google colab to use 3.5.
I found some solutions in Stackoverflow which asked me to use local run time which won't be useful for me because I don't have enough computational resources in my local machine.
如何强迫google colab在特定的python版本中运行
0
人关注
2
个评论
事实上,你可以,看。
stackoverflow.com/a/71511943/1854249
Eswar Chitirala
发布于
2020-01-17
1
个回答
ngrislain
发布于
2022-03-17
0
人赞同
有一种方法可以使用你想要的任何版本的python,比方说python3.5,而不必在本地运行内核或通过ngrok代理。
下载colab笔记本。打开一个文本编辑器,将内核规格改为:。
"kernelspec": {
"name": "py35",
"display_name": "Python 3.5"
然后将编辑好的笔记本上传到Google Drive。在Google Colab中打开该笔记本。它找不到py35的内核,所以它使用普通的python3内核。
你需要安装一个Python 3.5的google-colab
包和你上面定义的ipykernel
的名字。"py35"。
!apt-get install python3.5
!curl -O https://bootstrap.pypa.io/pip/3.5/get-pip.py
!python3.5 get-pip.py
!python3.5 -m pip install jupyter google-colab
!python3.5 -m ipykernel install --name "py35" --user