求助!!python3.7.4 找不到 http.server

阿飞skye 2019-07-24 05:08:21
from http.server import HTTPServer,BaseHTTPRequestHandler
报错信息
from http.server import HTTPServer,BaseHTTPRequestHandler
ModuleNotFoundError: No module named 'http.server'; 'http' is not a package
如果需要下载这个模块 请告知去哪里下载 我搜了很久的百度都是垃圾信息
...全文
1771 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
小羽Jary 2019-07-26
  • 打赏
  • 举报
回复
你现在试一下import http可以不
阿飞skye 2019-07-26
  • 打赏
  • 举报
回复
引用 4 楼 小羽_Jun 的回复:
http模块要自己下载,pip install http 。如果出错,要先安装request



安装request成功率。。可install http还是失败了
PS E:\python_example> pip install request
Collecting request
Downloading https://files.pythonhosted.org/packages/f1/27/7cbde262d854aedf217061a97020d66a63163c5c04e0ec02ff98c5d8f44e/request-2019.4.13.tar.gz
Collecting get (from request)
Downloading https://files.pythonhosted.org/packages/3f/ef/bb46f77f7220ac1b7edba0c76d810c89fddb24ddd8c08f337b9b4a618db7/get-2019.4.13.tar.gz
Collecting post (from request)
Downloading https://files.pythonhosted.org/packages/0f/05/bd79da5849ea6a92485ed7029ef97b1b75e55c26bc0ed3a7ec769af666f3/post-2019.4.13.tar.gz
Requirement already satisfied: setuptools in c:\program files\python37\lib\site-packages (from request) (40.8.0)
Collecting query_string (from get->request)
Downloading https://files.pythonhosted.org/packages/12/3c/412a45daf5bea9b1d06d7de41787ec4168001dfa418db7ec8723356b119f/query-string-2019.4.13.tar.gz
Collecting public (from query_string->get->request)
Downloading https://files.pythonhosted.org/packages/54/4d/b40004cc6c07665e48af22cfe1e631f219bf4282e15fa76a5b6364f6885c/public-2019.4.13.tar.gz
Installing collected packages: public, query-string, get, post, request
Running setup.py install for public ... done
Running setup.py install for query-string ... done
Running setup.py install for get ... done
Running setup.py install for post ... done
Running setup.py install for request ... done
Successfully installed get-2019.4.13 post-2019.4.13 public-2019.4.13 query-string-2019.4.13 request-2019.4.13
PS E:\python_example> pip install http
Collecting http
Using cached https://files.pythonhosted.org/packages/e3/91/a9260805e532e33df273b8f7dffad5c51693f8f9ba5f86bedcf42a7f22eb/http-0.02.tar.gz
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-k4cgmk3h\\http\\setup.py'"'"'; __file__='"'"'C:\\Users\\Administrator\\AppData\\Local\\Temp\\pip-install-k4cgmk3h\\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 pip-egg-info
cwd: C:\Users\Administrator\AppData\Local\Temp\pip-install-k4cgmk3h\http\
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Administrator\AppData\Local\Temp\pip-install-k4cgmk3h\http\setup.py", line 3, in <module>
import http
File "C:\Users\Administrator\AppData\Local\Temp\pip-install-k4cgmk3h\http\http\__init__.py", line 17, in <module>
from request import Request
ImportError: cannot import name 'Request' from 'request' (c:\program files\python37\lib\site-packages\request\__init__.py)
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

小羽Jary 2019-07-25
  • 打赏
  • 举报
回复
http模块要自己下载,pip install http 。如果出错,要先安装request
tianfang 2019-07-25
  • 打赏
  • 举报
回复
引用 2 楼 阿飞skye 的回复:
[quote=引用 1 楼 tianfang 的回复:] 不需要下载 http.server在python自身的库(Lib/http/server.py),有问题的话,是python安装的不全,或者运行环境有问题
我的环境是新安装的[/quote] 新安装就完整了?看到(Lib/http/server.py)了吗?你怎么运行程序的?
阿飞skye 2019-07-24
  • 打赏
  • 举报
回复
引用 1 楼 tianfang 的回复:
不需要下载 http.server在python自身的库(Lib/http/server.py),有问题的话,是python安装的不全,或者运行环境有问题


我的环境是新安装的
tianfang 2019-07-24
  • 打赏
  • 举报
回复
不需要下载 http.server在python自身的库(Lib/http/server.py),有问题的话,是python安装的不全,或者运行环境有问题

37,741

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧