gpt4 book ai didi

python - 如何在 Google Colab 上安装以前版本的 Tensorflow?

转载 作者:行者123 更新时间:2023-12-02 16:46:21 29 4
gpt4 key购买 nike

我使用 !pip uninstall tensorflow -y 然后 !pip uninstall tensorflow-gpu -y 卸载了 Google Colab 上预装的 Tensorflow 版本。然后我安装了我想要的版本 !pip install tensorflow-gpu==1.4.1 这似乎有效并且它输出 Successfully installed tensorflow-gpu-1.4.1。但是,当我运行 !pip show tensorflow 时,我得到 WARNING: Package(s) not found: tensorflow.

我已经尝试在安装 Tensorflow 后重新启动运行时,但没有成功。我也在运行 GPU 运行时。

此外,当我运行时:

将tensorflow导入为tf
打印(tf.__version__)

我收到以下错误:

---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py in <module>()
57
---> 58 from tensorflow.python.pywrap_tensorflow_internal import *
59 from tensorflow.python.pywrap_tensorflow_internal import __version__

10 frames
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py in <module>()
70 for some common reasons and solutions. Include the entire stack trace
71 above this error message when asking for help.""" % traceback.format_exc()
---> 72 raise ImportError(msg)
73
74 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long

ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

如何解决这个问题才能正确安装 Tensorflow 1.4.1?我已经尝试在安装 Tensorflow 后重新启动运行时,但这没有用。我也在运行 GPU 运行时。

最佳答案

尝试使用以下命令重新安装 tensorflow

!pip uninstall tensorflow -y
!pip install tensorflow==1.14

然后在 colab 中询问时重新启动运行时。您应该能够导入正确版本的 TensorFlow。

%tensorflow_version 1.x
import tensorflow as tf
print(tf.__version__)

1.14.0

关于python - 如何在 Google Colab 上安装以前版本的 Tensorflow?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60358413/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com