1.错误信息:AttributeError: module ‘pydot‘ has no attribute ‘find_graphviz‘
1.安装pydot-ng
由于pydot里面已经没有这个find_graphviz()方法了,选择安装pydot-ng
activate python虚拟环境
pip install pydot-ng
2.安装graphviz
到graphviz官网上下载exe并点击安装,勾选添加到全局变量。
或者记住安装位置选择手动添加到path变量里面。
测试是否安装成功:win+r进入cmd
![在这里插入图片描述](https://img-blog.csdnimg.cn/b1a6a290fa8a42d8bb1d9f7a92bc164f.png
2.gitbash进入虚拟环境报错
错误信息:UnicodeEncodeError: 'gbk' codec can't encode character '\xc1'
解决办法:打开Git Bash ——>右键选择Options ——>设置Locale=zh_CN Character set=GBK ——>关闭Git Bash重新运行conda activate envName
——>成功
3.运行报错AssertionError: Torch not compiled with CUDA enabled
报错原因:torch的版本和cuda的版本不匹配
解决办法:
- cmd 运行:
nvidia -smi
查看自己的cuda版本
2.然后去torch官网中查看老版本CUDA适配的torch版本:
https://pytorch.org/get-started/previous-versions/
3.如果没找到合适版本的,去这个pytorh官网的whl文件里面找
https://download.pytorch.org/whl/
cmd 进入whl的文件目录下运行即可
pip install 文件名.whl
4.cuda11.4下载cuda11.3对应的版本
# CUDA 11.3
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113
4.自建虚拟环境的pip更新出错
报错信息:运行 python -m pip install --upgrade pip 没有更新pip的版本
解决办法:
1.先升级pip的版本:参考博客
cmd运行,升级pip的版本
activate base
python -m pip install
2.复制pip的新版本文件夹到创建的环境里面去
5.pip 安装包报错: ssl证书验证失败
错误信息:Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/pandas/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) - skipping
解决办法:参考博客
修改命令如下 :
pip install Pandas -i http://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
–trusted-host 是信任这个地址,可以免去ssl验证
6.安装torch报错
错误信息:unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
解决办法:参考博客
使用pip代替conda安装
将命令:
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch
替换为:
pip install torch==1.10.2+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113 --trusted-host pypi.tuna.tsinghua.edu.cn