作者:网族桃源rl | 来源:互联网 | 2023-08-23 13:16
参照FlaskWebDevelopment里面的第7章大型程序的结构,在pycharm里面建立了名为flasky的程序,结果运行的时候报错fromflaskimp
参照 Flask Web Development
里面的第7章大型程序的结构,在pycharm里面建立了名为flasky的程序,结果运行的时候报错
from flask import Flask ImportError: No module named flask
错误内容如下:
1 2 3 4 5 6 7 8
| AAMacBook-Air:flasky username$ python manage.py
Traceback (most recent call last):
File "manage.py", line 3, in
from app import create_app, db
File "/Users/username/PycharmProjects/flasky/app/__init__.py", line 1, in
from flask import Flask
ImportError: No module named flask
AAMacBook-Air:flasky username$ |
同时我怕自己写错了,从github下了个当前的版本,运行的时候同样提示一样的内容。但是很奇怪的是,如果我直接用pycharm建立一个flask的程序是没有问题的,请问各位大神该如何能够解决这个问题,同时这个问题是因为什么才产生的。
跪求,已经2周没有下一步紧张了
程序目录机构如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| ----------
__pycache__ app config.py manage.py migrations requirement.txt tests
./__pycache__:
config.cpython-35.pyc
./app:
__init__.py __init__.pyc __pycache__ email.py main models.py static templates
./app/__pycache__:
__init__.cpython-35.pyc email.cpython-35.pyc models.cpython-35.pyc
./app/main:
__init__.py __pycache__ errors.py forms.py views.py
./app/main/__pycache__:
__init__.cpython-35.pyc errors.cpython-35.pyc forms.cpython-35.pyc views.cpython-35.pyc
./app/static:
./app/templates:
404.html 500.html base.html index.html mail
./app/templates/mail:
new_user.html new_user.txt
./migrations:
./tests: |