AttributeError: module ‘requests’ has no attribute ‘get’ [How to Solve]

I find that the file directly uses requests. Get (URL) to prompt me for attributeerror: module ‘requests’ has no attribute’ get ‘

The solution is as follows:

The python source file has the same name as the keyword

1. When naming py script, do not use the same reserved word and module name as python

2. Delete the. PyC file of the library (because the. PyC file is generated every time the PY script runs; When the. PyC file has been generated, if the code is not updated, the runtime will still run PyC, so delete the. PyC file and rerun the code; Or find an environment that can run the code, copy and replace the. PyC file of the current machine

Later, I found that there is a program with a requests.py file in my path. If I delete it, I won’t report this kind of error

Similar Posts: