如何在 Colab 中安装 tensorflow 1.12?
How to install tensorflow 1.12 in Colab?
我一直在尝试 运行 Colab 中其他人的代码,并且已经为此苦苦挣扎了好几天(我试图避免安装它的 tensorflow 版本,但这似乎是必要的)。
我显然尝试过:
!pip install tensorflow==1.12
但是它说:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.12 (from versions: 1.13.1, 1.13.2, 1.14.0, 1.15.0, 1.15.2, 1.15.3, 1.15.4, 1.15.5, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2.0rc0, 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0rc0, 2.4.0rc1, 2.4.0rc2, 2.4.0rc3, 2.4.0rc4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.5.0, 2.5.1, 2.5.2, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.8.0rc0)
ERROR: No matching distribution found for tensorflow==1.12
我也试过:
!pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl
并得到:
ERROR: tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.
有谁知道哪个命令有效?
感谢 William D. Irons 的帮助。这是我最终得到的代码:
from IPython.display import clear_output
import time
!add-apt-repository --yes ppa:deadsnakes/ppa
!apt-get update
!apt-get install python3.6
!apt-get install python3.6-dev
!wget https://bootstrap.pypa.io/get-pip.py && python3.6 get-pip.py
import sys
sys.path[2] = '/usr/lib/python36.zip'
sys.path[3] = '/usr/lib/python3.6'
sys.path[4] = '/usr/lib/python3.6/lib-dynload'
sys.path[5] = '/usr/local/lib/python3.6/dist-packages'
sys.path[7] = '/usr/local/lib/python3.6/dist-packages/IPython/extensions'
!pip install tensorflow==1.12
clear_output()
time.sleep(1)
import os
os.kill(os.getpid(), 9) #(This automatically restarts the runtime so the changes take effect)
重启后,你就运行这个:
%tensorflow_version 1.x
import sys
sys.path[3] = '/usr/lib/python36.zip'
sys.path[4] = '/usr/lib/python3.6'
sys.path[5] = '/usr/lib/python3.6/lib-dynload'
sys.path[6] = '/usr/local/lib/python3.6/dist-packages'
sys.path[8] = '/usr/local/lib/python3.6/dist-packages/IPython/extensions'
!pip install tensorflow==1.12
from IPython.display import clear_output
import tensorflow as tf
clear_output()
print(tf.__version__) #(This is just to check that everything went right)
你准备好了。希望它能帮助遇到同样问题的其他人
我一直在尝试 运行 Colab 中其他人的代码,并且已经为此苦苦挣扎了好几天(我试图避免安装它的 tensorflow 版本,但这似乎是必要的)。
我显然尝试过:
!pip install tensorflow==1.12
但是它说:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.12 (from versions: 1.13.1, 1.13.2, 1.14.0, 1.15.0, 1.15.2, 1.15.3, 1.15.4, 1.15.5, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2.0rc0, 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0rc0, 2.4.0rc1, 2.4.0rc2, 2.4.0rc3, 2.4.0rc4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.5.0, 2.5.1, 2.5.2, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.8.0rc0)
ERROR: No matching distribution found for tensorflow==1.12
我也试过:
!pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl
并得到:
ERROR: tensorflow-1.12.0-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.
有谁知道哪个命令有效?
感谢 William D. Irons 的帮助。这是我最终得到的代码:
from IPython.display import clear_output
import time
!add-apt-repository --yes ppa:deadsnakes/ppa
!apt-get update
!apt-get install python3.6
!apt-get install python3.6-dev
!wget https://bootstrap.pypa.io/get-pip.py && python3.6 get-pip.py
import sys
sys.path[2] = '/usr/lib/python36.zip'
sys.path[3] = '/usr/lib/python3.6'
sys.path[4] = '/usr/lib/python3.6/lib-dynload'
sys.path[5] = '/usr/local/lib/python3.6/dist-packages'
sys.path[7] = '/usr/local/lib/python3.6/dist-packages/IPython/extensions'
!pip install tensorflow==1.12
clear_output()
time.sleep(1)
import os
os.kill(os.getpid(), 9) #(This automatically restarts the runtime so the changes take effect)
重启后,你就运行这个:
%tensorflow_version 1.x
import sys
sys.path[3] = '/usr/lib/python36.zip'
sys.path[4] = '/usr/lib/python3.6'
sys.path[5] = '/usr/lib/python3.6/lib-dynload'
sys.path[6] = '/usr/local/lib/python3.6/dist-packages'
sys.path[8] = '/usr/local/lib/python3.6/dist-packages/IPython/extensions'
!pip install tensorflow==1.12
from IPython.display import clear_output
import tensorflow as tf
clear_output()
print(tf.__version__) #(This is just to check that everything went right)
你准备好了。希望它能帮助遇到同样问题的其他人