Loading

【Anaconda】Ubuntu下anaconda安装tensorflow-gpu遇到的问题

创建虚拟环境并激活后
<br />$ conda create -n tensorflow python=3.9<br />$ conda activate tensorflow<br />
使用下面指令安装tensorflow时显示"Solving environment :failed with initial frozen solve. Retrying with flexible solve."
$ conda install tensorflow==2.6.0

换成pip install -i https://pypi.tsinghua.edu.cn/simple tensorflow-gpu==2.8.0
安装成功后,导入tensorflow出现:

根据提示,执行下面的pip安装命令
$ pip install protobuf==(~)3.19.0
最后执行下面的命令,输出为True

 print(tf.test.is_gpu_available())```
### 安装pytorch
```$ conda activate tensorflow<br />$ conda install pytorch torchvision torchaudio cpuonly<br />```
验证安装,输出1.13.1
```python import torch torch.__version__```
查看是否调用gpu
```print(torch.cuda.is_available())```
<br />改用<br />
```<br />pip install torch==1.12.0+cu113 torchvision==0.13.0+cu113 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu113<br />```
posted @ 2024-03-29 23:54  踩坑大王  阅读(103)  评论(0)    收藏  举报