Pytorch出現(xiàn)錯誤Attribute?Error:module?‘torch‘?has?no?attribute?'_six'解決
1. 問題描述:我是在VScode中使用jupyter拓展,遠程連接服務器。
2. torch版本:2.0
3. pytorch版本: 1.9.1
4. 問題原因:torch 2.0版本以后中沒有 ‘_six.py’ 文件
5. 如何查看torch中的py文件?
我是用的anaconda,torch中的py文件位置為:
/envs/環(huán)境名/lib/python版本號(比如:python3.8)/site-packages/torch
6. 解決辦法
(1)我第一開始試著把torch1.9中的’_six.py’文件復制到torch2.0中,發(fā)現(xiàn)還是不行(不知道為啥,有大佬能解釋一下嗎?)
然后我又重新裝了torch1.9.1,問題解決了!
步驟如下:
pip uninstall torch
pip install torch==1.9.1
Tips: 如果在步驟5中發(fā)現(xiàn)有’_six.py’文件,可以點擊重啟jupyter kernel即可解決。
總結
到此這篇關于Pytorch出現(xiàn)錯誤Attribute Error:module ‘torch‘ has no attribute '_six'解決的文章就介紹到這了,更多相關Pytorch錯誤Attribute Error內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
- python錯誤:AttributeError: ''module'' object has no attribute ''setdefaultencoding''問題的解決方法
- 解決python多線程報錯:AttributeError: Can''t pickle local object問題
- Python3下錯誤AttributeError: ‘dict’ object has no attribute’iteritems‘的分析與解決
- Python 中 AttributeError: ‘NoneType‘ object has no attribute ‘X‘ 錯誤問題解決方案
- 解決AttributeError:'NoneTypeobject'?has?no?attribute'Window'的問題(親測有效)
- Python進程崩潰AttributeError異常問題解決