Python中出現request模塊導入錯誤

python項目中 from urllib.request import urlopen ,導入request出問題,而進行完 pip install request 安裝後,仍會出現該錯誤。
錯誤提示:
ImportError: No module named request
問題分析:
python 3.x版本與2.x版本不兼容的問題,在python 2.x中 urlopen 模塊在urllib2中。
解決方法:
改爲from urllib2 import urlopen。

版本區別具體可參考:https://blog.csdn.net/weixin_42078760/article/details/81537077

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章