Windows10上的Python3.6.2" ImportError:无法导入名称' Flask'"

时间:2017-12-05 09:42:34

标签: windows python-3.x

我尝试在Windows 10中运行Flask。但是我看到错误:

(HelloWorls) PS C:\Users\r.tjutin\PycharmProjects\untitled\learn> C:\Users\r.tjutin\Envs\HelloWorls\Scripts\python.exe C:/Users/r.tjutin/PycharmProjects/untitled/learn/flask.py
Traceback (most recent call last):
File "C:/Users/r.tjutin/PycharmProjects/untitled/learn/flask.py", line 2, in <module>
    from flask import Flask
File "C:\Users\r.tjutin\PycharmProjects\untitled\learn\flask.py", line 2, in <module>
    from flask import Flask
ImportError: cannot import name 'Flask'
(HelloWorls) PS C:\Users\r.tjutin\PycharmProjects\untitled\learn> pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
click (6.7)
Flask (0.12.2)
itsdangerous (0.24)
Jinja2 (2.10)
MarkupSafe (1.0)
pip (9.0.1)
setuptools (38.2.4)
Werkzeug (0.12.2)
wheel (0.30.0)
(HelloWorls) PS C:\Users\r.tjutin\PycharmProjects\untitled\learn>
(HelloWorls) PS C:\Users\r.tjutin\PycharmProjects\untitled\learn> python.exe --version
Python 3.6.2

请帮帮我,我累了搜索。我使用virtualenv来创建工作区,我使用activate.bat工作区,我使用了powershell代替cmd,没有任何效果。

1 个答案:

答案 0 :(得分:0)

名称脚本flask.py不好。但模块名称瓶是导入您的脚本。请重命名脚本flask.py - &gt;以flask1.py为例,然后运行它。