Hi, I just installed requests with pip but I can't import it

后端 未结 2 875
眼角桃花
眼角桃花 2021-01-29 02:44

For example my Code is:

import requests  
r = requests.get(\'https://www.python.org\')  
r.status_code  

And the Result is:



        
2条回答
  •  攒了一身酷
    2021-01-29 02:54

    Well, as issue is that Requests require Python-3.3 or higher so you will need to upgrade your Python. I noticed you are on windows so follow this link to download the installer for latest stable Python-3.5.2 (https://www.python.org/ftp/python/3.5.2/python-3.5.2-webinstall.exe).

    Also, look into using virtualenvs(https://virtualenv.pypa.io/en/stable/). They are a great way to insulate the python packages you have installed and you can set it up using for different projects that may have different requirements.

提交回复
热议问题