当我使用这个命令“pip3 install http”安装“http模块”时,发生了一个错误
ERROR: Command errored out with exit status 1:
command: 'c:\users\ibrah\appdata\local\programs\python\python38-32\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ibrah\\AppData\\Local\\Temp\\pip-install-dn_zr423\\http\\setup.py'"'"'; __file__='"'"'C:\\Users\\ibrah\\AppData\\Local\\Temp\\pip-install-dn_zr423\\http\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\ibrah\AppData\Local\Temp\pip-pip-egg-info-4bhyjyb0'
cwd: C:\Users\ibrah\AppData\Local\Temp\pip-install-dn_zr423\http\
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ibrah\AppData\Local\Temp\pip-install-dn_zr423\http\setup.py", line 3, in <module>
import http
File "C:\Users\ibrah\AppData\Local\Temp\pip-install-dn_zr423\http\http\__init__.py", line 17, in <module>
from request import Request
ImportError: cannot import name 'Request' from 'request' (c:\users\ibrah\appdata\local\programs\python\python38-32\lib\site-packages\request\__init__.py)
----------------------------------------
错误:命令出错,退出状态1:python setup.py egg_info检查日志以获得完整的命令输出。
如何解决这个问题
之所以出现错误,很可能是因为http模块已经存在于python安装中(假设Python3.7默认附带此模块):
https://docs.python.org/3.7/library/http.html
因此您不需要安装它,您可以直接导入它:
import http