2 回答

TA贡献1872条经验 获得超3个赞
最近我向朋友发送了使用 conda 安装 cuda 和 tf-gpu 的说明(因为这很快) - 在互联网上搜索了一段时间后,我的协议是这样的:
##########################
# Install Miniconda
##########################
mkdir -p ~/install
cd ~/install
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
# I guess on a mac you should do
# wget https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
#########################
# install nvidia driver
# so these are the linux (ubuntu) commands
# for mac, maybe one should follow the scheme
# removing nvidia drivers first
# and then download newest nvidia driver
# and install it
# and reboot
#
# If you are using a laptop without gpu, just skip this block
#########################
sudo apt purge nvidia-* # remove all nvidia driver first
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt install nvidia-driver-418
sudo apt install nvidia-cuda-toolkit
# reboot
sudo reboot
#########################
# install machine learning stuff keras tensorflow-gpu
#
# if you are installing in a laptop without gpu,
# replace 'tensorflow-gpu' by 'tensorflow'!
#########################
conda create --name keras
conda activate keras
conda install python ipython jupyter pandas scipy seaborn scikit-learn tensorflow-gpu keras pytest openpyxl graphviz
#########################
# finally, test a successful installation by:
# entering:
ipython # and there trying:
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
# should list gpu
# sth like:
physical_device_desc: "device: 0, name: GeForce GTX 1050 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1"
, name: "/device:XLA_GPU:0"
device_type: "XLA_GPU"
memory_limit: 17179869184
locality {
}
incarnation: 14085000268159177816
physical_device_desc: "device: XLA_GPU device"
]

TA贡献1911条经验 获得超7个赞
从您的日志中:
无法 dlopen 库“libcudart.so.10.0”;dlerror:libcudart.so.10.0:无法打开共享对象文件:没有这样的文件或目录;
你安装了CUDA 10.1但是TF-GPU需要CUDA 10.0,所以你需要安装它(不需要卸载10.1的,它们可以共存)
添加回答
举报