How to install requests in python?
● Under Windows system, you only need to enter the command pip install requests, that is Installable.
● Under Linux system, you only need to enter the command sudo pip install requests to install.
Note: Regarding the installation of python third-party libraries, it is best to use easy_install less, because easy_install can only install but not uninstall. If you want to uninstall, you need to enter the lib folder under the python installation directory and manually delete the corresponding module content. Therefore, it is recommended to use pip to install. When installing, use the pip install module name command to install. When uninstalling, use the pip uninstall module name command to delete.
Since we often run into walls when using pip or easy_install to install in China, we will focus on another installation method below.
#step1: Download requests
Open this website, http://www.lfd.uci.edu/~gohlke/pythonlibs There are many python on this website For third-party library files, we can easily find requests by pressing ctrl f to search. Click on the .whl file and download it.
#step2: Add to lib
After downloading the .whl file, rename the file, change the suffix name from .whl to .zip, and then unzip it file, we can get two folders. We copy the first folder, which is the requests folder, to the lib directory in the python installation directory.
#step3: Test
At this point, requests has been installed. We can enter the import requests command to try whether the installation is successful. If there is no error, it means requests has been installed successfully. .
Finally, this method is not only suitable for the installation of the requests module, but also for other modules. You can download and decompress it and copy the corresponding content directly to the lib directory.
Related recommendations: "Python Tutorial"
The above is the detailed content of How to install request in python. For more information, please follow other related articles on the PHP Chinese website!