I'm runing a python code for deep learning in google colab. Python 3.5 is required for that code. How can I install Python 3.5 version in google colab ?
这对我有用。
!apt-get install python3.5
If you do !python3 --version
you can see colab current uses Python 3.6.7 which is "python version of 3.5 or above"
alternatively you can use local runtime, this will allow you to use different versions of python
The following code snippet below will download Python 3.5 without any Colab pre-installed libraries (such as Tensorflow). You can install them later with pip, like !pip install tensorflow
. Please note that this won't downgrade your default python in colab, rather it would provide a workaround to work with other python versions in colab. To run any python scripts with 3.5 version, use !python3.5
instead of !python
.
!add-apt-repository ppa:deadsnakes/ppa
!apt-get update
!apt-get install python3.5
!apt-get install python3.5-dev
!wget https://bootstrap.pypa.io/get-pip.py && python3.5 get-pip.py
import sys
sys.path[2] = '/usr/lib/python35.zip'
sys.path[3] = '/usr/lib/python3.5'
sys.path[4] = '/usr/lib/python3.5/lib-dynload'
sys.path[5] = '/usr/local/lib/python3.5/dist-packages'
sys.path[7] ='/usr/local/lib/python3.5/dist-packages/IPython/extensions'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.