gpt4 book ai didi

python - 成功安装flask,仍然出现导入错误

转载 作者:行者123 更新时间:2023-12-01 03:05:14 25 4
gpt4 key购买 nike

我第一次使用 Flask 和 Python 尝试创建一个 Web 应用程序。我在 Windows 10 上使用 Cygwin;由于某种原因,即使我已经使用 pip 成功安装了 Flask:

$ pip install flask
Requirement already satisfied (use --upgrade to upgrade): flask in c:\python34\l ib\site-packages
Requirement already satisfied (use --upgrade to upgrade): click>=2.0 in c:\pytho n34\lib\site-packages (from flask)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in c:\pyth on34\lib\site-packages (from flask)
Requirement already satisfied (use --upgrade to upgrade): itsdangerous>=0.21 in c:\python34\lib\site-packages (from flask)
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in c:\py thon34\lib\site-packages (from flask)
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe>=0.23 in c: \python34\lib\site-packages (from Jinja2>=2.4->flask)
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm and.

运行 python app.py 时仍然出现此错误:

$ python app.py
Traceback (most recent call last):
File "app.py", line 1, in <module>
from flask import Flask
ImportError: No module named flask

有什么想法吗?抱歉,如果这是一个愚蠢的问题,这是一个很新的问题。

最佳答案

如果您不想使用 virtualenv,请尝试此操作:

python -m pip install --upgrade pip
python -m pip install flask

关于python - 成功安装flask,仍然出现导入错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43501051/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com