为什么python安装了requests库但运行时仍然显示未安装?
1个回答
展开全部
一定要切到Python的主目录下安装requests。
如果提示已经安装,那原因是安装的路径不正确,需要先卸载。找到现在的安装目录(会提示),在CMD窗口切过去,执行:
pip uninstall requests
C:\Users\Administrator>pip uninstall requests
Uninstalling requests-2.14.2:
c:\programdata\anaconda3\lib\site-packages\requests
c:\programdata\anaconda3\lib\site-packages\requests-2.14.2-py3.6.egg-info
Proceed (y/n)? y
Successfully uninstalled requests-2.14.2
然后,将目录切到Python的安装目录下,执行:
pip install requests.
————————————————
如果提示已经安装,那原因是安装的路径不正确,需要先卸载。找到现在的安装目录(会提示),在CMD窗口切过去,执行:
pip uninstall requests
C:\Users\Administrator>pip uninstall requests
Uninstalling requests-2.14.2:
c:\programdata\anaconda3\lib\site-packages\requests
c:\programdata\anaconda3\lib\site-packages\requests-2.14.2-py3.6.egg-info
Proceed (y/n)? y
Successfully uninstalled requests-2.14.2
然后,将目录切到Python的安装目录下,执行:
pip install requests.
————————————————
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询