Import Error: No module named requests

前端 未结 3 1785
慢半拍i
慢半拍i 2021-01-15 09:30

I know there are many posts on this, and I\'ve tried using the solutions provided, but to no avail. I tried pip install requests and pip install requests

相关标签:
3条回答
  • 2021-01-15 09:45

    You installed requests into a different Python installation. The /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages is the site-packages directory for the Mac OS X /usr/bin/python installation.

    PyCharm is not currently configured to use that Python installation; check what Python is being used either by looking at your PyCharm settings, or by asking Python directly with:

    import sys
    print(sys.executable)
    

    Note that PyCharm can handle package installations for you as well; rather than use the command line pip consider using PyCharm, as it'll use the currently configured Python installation in that case.

    0 讨论(0)
  • 2021-01-15 09:59

    If you are having this issue in Pycharm and you have configured your Pycharm to create projects in virtual environments, then you can use the Terminal in Pycharm to run the

    pip3 install requests 
    

    to resolve this issue. This is by design to ensure you control dependencies.

    0 讨论(0)
  • 2021-01-15 10:02

    install package name "request" from pychram package setting. then it will be work fine.

    0 讨论(0)
提交回复
热议问题