我尝试用一些基本的例子来学习烧瓶,但即使是原始烧瓶网站上的例子,我也会收到来自Werkzeug http.py的错误。
以下是代码:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
以下是错误:https://pastebin.com/7N1TP0zm
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\werkzeug\http.py", line 26, in <module>
from urllib.request import parse_http_list as _parse_list_header
File "C:\Program Files\Python36\lib\urllib\request.py", line 88, in <module>
import http.client
File "C:\Users\Adrien\Desktop\http.py", line 1, in <module>
from flask import Flask
ImportError: cannot import name 'Flask'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Adrien\Desktop\http.py", line 1, in <module>
from flask import Flask
File "C:\Program Files\Python36\lib\site-packages\flask\__init__.py", line 17, in <module>
from werkzeug.exceptions import abort
File "C:\Program Files\Python36\lib\site-packages\werkzeug\__init__.py", line 151, in <module>
__import__('werkzeug.exceptions')
File "C:\Program Files\Python36\lib\site-packages\werkzeug\exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "C:\Program Files\Python36\lib\site-packages\werkzeug\wrappers.py", line 26, in <module>
from werkzeug.http import HTTP_STATUS_CODES, \
File "C:\Program Files\Python36\lib\site-packages\werkzeug\http.py", line 29, in <module>
from urllib2 import parse_http_list as _parse_list_header, \
ModuleNotFoundError: No module named 'urllib2'
其他信息:
我尝试过多次unistalling并安装python,但它没有帮助。 在此先感谢您的帮助。
编辑: 在尝试安装urllib2时,我收到此错误:
Could not find a version that satisfies the requierement urllib2 (from versions: )
No matching distribution found for urllib2