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.youkuaiyun.com/weixin_42078760/article/details/81537077
转载于:https://blog.51cto.com/13402621/2156788