【持续更】总结 python、pycharm错误总结

本文总结了在使用PyCharm过程中遇到的各种错误及解决方法,包括远程调试时的ImportError,opencv-python安装后的ImportError,cudnn错误,pip安装包时的EnvironmentError,optimizer加载状态时报内存不足,cv2.imwrite失败以及PyCharm注释快捷键问题。通过指定环境变量、安装缺失库、修改配置等方法可以解决这些问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、远程调试pycharm时候出现的错误:ImportError

ImportError: libcusolver.so.8.0: cannot open shared object file: No such file or directory

解决方法:pycharm上方菜单栏:run->configurations->environment variable,添加:

LD_LIBRARY_PATH    /home/cudnn5.1/lib64/:/usr/local/cuda-8.0/lib64/

 

2、安装opencv-python之后出现错误:ImportError

ImportError错误,cannot open shared object file: No such file or directory

ImportError: libSM.so.6: cannot open shared object file: No such file or directory

解决方法:把缺失的包安装好,在终端敲入如下命令:

 apt-get install libsm6

 apt-get install libxrender1

 apt-get install libxext-dev

 

3、cudnn error

1)环境没配好

2)cudnn.benchmark=False

 

4、【pip】Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问

解决办法:在install之后加–user

pip install --user pkgs

 

5、optimizer.load_state_dict语句上报out of memory

在cpu上导入数据:map_location='cpu'

checkpoint = torch.load(path, map_location='cpu')

 

6. cv2.imwrite 失败

要先os.remove源文件,再imwrite

 

7、pycharm注释 ctrl+/ 不管用

把下图上红框里的Ctrl改成其他键保存就可以了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值