[Python] 'requests' imported module won't work on IDLE

Discussão em 'Python' iniciado por Stack, Maio 27, 2025.

  1. Stack

    Stack Membro Participativo

    I downloaded the module requests in the command prompt using 'pip install requests'. It downloads fine and works from the command prompt, but when trying to import from the IDLE PyCharm I get the error message:

    Traceback (most recent call last):

    File "C:/Users/asher/PycharmProjects/begginer_questions/decode_a_web_page.py", line 1, in <module>
    import requests
    ModuleNotFoundError: No module named 'requests'


    By copy-pasting the 'requests' file into the location:

    C:/Users/asher/PycharmProjects/begginer_questions


    along with the files contained in the file path:

    C:/Users/asher/PycharmProjects/begginer_questions/venv/Lib/site-packages/pip-19.0.3-py3.7.egg/pip/_vendor


    The code shown below finally gave no error messages.

    However, this only seems like a temporary fix. Is there a permanent fix that could work or any reasons as to why this is happening?

    The two common problems which often cause this to occur is that multiple versions of Python are downloaded and there is already a file called requests.py, neither are the case for me. I also don't understand why I had to copy-paste the second bunch of files considering they're already contained in begginer_questions.

    I'm on Windows 10 with Python 3.7.3.

    import requests

    url = 'https://www.nytimes.com'
    r = requests.get(url)
    r_html = r.text

    Continue reading...

Compartilhe esta Página