如何运行从GitHub下载的Python脚本?

2024-10-01 00:31:44 发布

您现在位置:Python中文网/ 问答频道 /正文

https://github.com/AliFlux/MapTilesDownloader 我尝试了以下方法:

PS C:\Program Files\MapTilesDownloader-master\src> python server.py

但我得到了以下结果:

Traceback (most recent call last):
  File "server.py", line 3, in <module>
    from http.server import BaseHTTPRequestHandler, HTTPServer
ImportError: No module named http.server

你能帮我解决这个问题吗? 先谢谢你


Tags: 方法pyhttpssrcgithubmastercomhttp
2条回答

首先想到的是,您要么没有使用python3,要么没有安装Pillow库。要安装枕头,您可以执行以下操作:

pip3 install pillow

(您可以使用pip而不是pip3) 在终端/命令行中,然后执行以下操作:

python3 server.py

如果python3不工作,可能意味着没有安装python3,请按照python网站上的说明进行操作

这应该是因为您使用了错误的Python版本,您需要Python3来使用http.server

检查一下这个link,此人也有类似的问题,尝试用python3 server.py启动服务器,如果它不工作,您可能必须下载Python 3

相关问题 更多 >