1. 程式人生 > >python 中json has no attribute 'loads'

python 中json has no attribute 'loads'

.py 尋找 load 存在 attribute 其中 行程 運行程序 sta

在python爬蟲時出現了json has no attribute ‘loads‘問題。

1 可能是沒有安裝json包,cmd-pip install json, 顯示已安裝。

2 當前盤中存在json.py文件,導致錯誤。

因為我的python文件是保存在F盤中的,而F盤中有名為json.py的文件,所以運行程序時首先在F盤中尋找json文件,名稱有json的被認為json包,而其中沒有loads模塊。

3 解決辦法:把F盤中的json.py改名為json1.py重新運行程序,問題解決。

python 中json has no attribute 'loads'