提示:可在python环境中进行安装,避免环境污染,创建命令conda create -n xxx_name python=3.9,激活conda activate xxx_name
第一步:查看计算机平台版本
在窗口输入查看命令,查看CUDA的版本
nvidia-smi

二、根据以下条件进行选择自动生成安装命令:
快速安装路径:飞桨PaddlePaddle-源于产业实践的开源深度学习平台

三、踩坑记录:
1.AttributeError: 'ParallelEnv' object has no attribute '_device_id'

解决方法:paddle 2.6.0及以上版本中,应使用dist.get_world_size()
代替dist.ParallelEnv().nranks
,并且应使用dist.get_rank()
代替dist.ParallelEnv().local_rank.
即定位到program.py的677行将内容更改成如下所示:

2.ImportError: libcudart.so.11.0: cannot open shared object file: No such file or directory

解决方法:首先查看' libcudart.so.11.0'该文件是否存在:
【命令】 find 【路径】-name libcudart.so.11.0
例如: find /home/hadoop -name libcudart.so.11.0,结果显示:

选择结果中其中一个进行环境变量修改:
【命令】export LD_LIBRARY_PATH= /home/hadoop/xxx/data/lib/libcudart.so.11.0
【命令】source ~/.bashrc
重新运行Python,无错误显示即可

补充:常用的镜像源
清华:https://pypi.tuna.tsinghua.edu.cn/simple/
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学:https://pypi.mirrors.ustc.edu.cn/simple/
华中科技大学:http://pypi.hustunique.com/simple/
上海交通大学:https://mirror.sjtu.edu.cn/pypi/web/simple/
豆瓣:http://pypi.douban.com/simple/
安装方式:
pip install <安装包> -i <镜像源>
例如: pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple/