当我运行以下python脚本时
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello_World'
控制台输出以下内容:
* Serving Flask app "main.py"
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\jespe\Google Drive\Övrigt\Programmering\Python\Flask test\venv\Scripts\flask.exe\__main__.py", line 7, in <module>
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\flask\cli.py", line 967, in main
cli.main(args=sys.argv[1:], prog_name="python -m flask" if as_module else None)
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\flask\cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\click\core.py", line 782, in main
rv = self.invoke(ctx)
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\click\core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\click\core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\click\decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\click\core.py", line 610, in invoke
return callback(*args, **kwargs)
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\flask\cli.py", line 852, in run_command
run_simple(
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\werkzeug\serving.py", line 1052, in run_simple
inner()
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\werkzeug\serving.py", line 996, in inner
srv = make_server(
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\werkzeug\serving.py", line 847, in make_server
return ThreadedWSGIServer(
File "c:\users\jespe\google drive\övrigt\programmering\python\flask test\venv\lib\site-packages\werkzeug\serving.py", line 740, in __init__
HTTPServer.__init__(self, server_address, handler)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\socketserver.py", line 452, in __init__
self.server_bind()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\http\server.py", line 140, in server_bind
self.server_name = socket.getfqdn(host)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\socket.py", line 756, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 14: invalid continuation byte
操作系统:Windows 10 Python版本:3.8.5 烧瓶版本1.1.2
我通过cmd打开了一个venv,然后安装了flask,并尝试运行带有上述错误的脚本。