调用pip list可见已经成功安装了:

requests            2.21.0 

但是在运行时仍报错:

userdeMacBook-Pro:xiaohui user$ python test_web.py
Traceback (most recent call last):
  File "test_web.py", line 4, in <module>
    import requests
ImportError: No module named requests

可能是因为在本地安装了多个版本的python导致的,安装了python2和python3版本,运行时显示声明使用的是2版本即可:

python2 test_web.py

 

相关文章:

  • 2022-02-19
  • 2022-12-23
  • 2021-04-10
  • 2021-07-29
  • 2021-10-27
  • 2021-04-03
猜你喜欢
  • 2021-11-24
  • 2022-12-23
  • 2021-07-19
  • 2022-01-01
  • 2021-10-22
  • 2021-04-10
  • 2022-12-23
相关资源
相似解决方案