Today, when executing the script with Pycharm, error. as follows:
Troubleshooting:
1, check whether the installation requests
cmd enter the command: pip install requests
Suggesting a new version can be upgraded, then I upgraded.
Then enter the command: pip list
Description no environmental problems.
2, check whether the computer has multiple versions of python.
Note: If the computer has python2 and python3 coexistence situation requires pip specify the installation path, the system usually comes with python2.7, pip will be installed by default on python2 version. So when you use python3 still prompt No module named 'requests'.
Here I have deleted after version 2.7, and can not be found, to find the real last question, I can attest, I am here on a computer version of Python. So this is not a problem.
If the computer has multiple Python friends. May be the reason, the solution, there are many online, you can be found
3, interpreter aspects of the project.
My question is this configuration, find the reason, but also spent a long time
Before determining the download requests but pycharm still being given at the time of import, it may be configured path pycharm Python parser in question
The first modification is successful, but after the discovery of new projects, would not work.
(You can jump directly to the Second Amendment, because real success is not the first time)
Solution
l Open pycharm-> File-> Settings-> Project Interpreter-> set your python path, I was: D: \ Python36 \ python.exe, you can change it according to their python installation path. (But I was right path here)
I'm beginning to see Project Interpreter (click to add, view the path is so far as that is no problem.
After saving, re-run, the problem is solved.
Reference documents: