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

后端 未结 2 865
眼角桃花
眼角桃花 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 03:05

    Requests requires Python 3.3 or newer. It doesn't work on Python 3.2 as that version doesn't support the required u'...' compatibility syntax for string literals.

    From the requests documentation:

    Requests officially supports Python 2.6–2.7 & 3.3–3.5, and runs great on PyPy.

    Note that 3.2 is rather.. ancient. You really want to upgrade to a more recent Python 3 revision.

提交回复
热议问题