[英]tensorflow-gpu conda environment not working on ubuntu-20.04
我按照說明在 ubuntu 20.04 上安裝 tensorflow 使用 conda 安裝Tensorflow
conda create --name tf tensorflow-gpu
成功創建了 conda 環境。 但是tensorflow和gpu不起作用:
!18
python3 image_classification_efficientnet_fine_tuning.py
2021-04-25 13:08:58.235320: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2021-04-25 13:08:58.235341: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File "image_classification_efficientnet_fine_tuning.py", line 137, in <module>
import tensorflow as tf
File "/home/steve/.local/lib/python3.8/site-packages/tensorflow/__init__.py", line 436, in <module>
_ll.load_library(_main_dir)
File "/home/steve/.local/lib/python3.8/site-packages/tensorflow/python/framework/load_library.py", line 153, in load_library
py_tf.TF_LoadLibrary(lib)
tensorflow.python.framework.errors_impl.NotFoundError: /home/steve/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/core/kernels/libtfkernel_sobol_op.so: undefined symbol: _ZNK10tensorflow8OpKernel11TraceStringB5cxx11ERKNS_15OpKernelContextEb
使用 cuda 將 Tensorflow 安裝在 ubuntu-20.04 上非常困難。
為TensorFlow
創建 virtual_environment 后,您需要在該虛擬環境中安裝TensorFlow
。
conda create -n tf-gpu tensorflow-gpu # to create a virtual environment
conda activate tf-gpu # to activate the virtual environment
conda install tensorflow-gpu # to install tensorflow-gpu
注意:每當您想運行TensorFlow
代碼時,請在anaconda
中 select 這個'tf-gpu'
虛擬環境。
執行上述代碼后再次嘗試運行您的代碼,如果問題仍然存在,請告知我們。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.