七月老师,我是mac,安装flask后,好像没有成功。

来源:2-3 使用官方推荐的pipenv创建虚拟环境(很好用哦~)

hexiaomei

2018-11-30

(fisher-LZS5beAB) bash-3.2$ pipenv install flask
Installing flask…
Adding flask to Pipfile's [packages]…
✔ Installation Succeeded 
Pipfile.lock (662286) out of date, updating to (a65489)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
✔ Success! 
Updated Pipfile.lock (662286)!
Installing dependencies from Pipfile.lock (662286)…
  ?   ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 6/6 — 00:00:02
(fisher-LZS5beAB) bash-3.2$ flask
Traceback (most recent call last):
  File "/Users/pinghe/.local/share/virtualenvs/fisher-LZS5beAB/lib/python3.7/site-packages/flask/cli.py", line 529, in list_commands
    rv.update(info.load_app().cli.list_commands(ctx))
  File "/Users/pinghe/.local/share/virtualenvs/fisher-LZS5beAB/lib/python3.7/site-packages/flask/cli.py", line 384, in load_app
    'Could not locate a Flask application. You did not provide '
flask.cli.NoAppException: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory.
Usage: flask [OPTIONS] COMMAND [ARGS]...
  A general utility script for Flask applications.
  Provides commands from Flask, extensions, and the application. Loads the
  application defined in the FLASK_APP environment variable, or from a
  wsgi.py file. Setting the FLASK_ENV environment variable to 'development'
  will enable debug mode.
    $ export FLASK_APP=hello.py
    $ export FLASK_ENV=development
    $ flask run
Options:
  --version  Show the flask version
  --help     Show this message and exit.
Commands:
  routes  Show the routes for the app.
  run     Runs a development server.
  shell   Runs a shell in the app context.
(fisher-LZS5beAB) bash-3.2$ 
(fisher-LZS5beAB) bash-3.2$ 
(fisher-LZS5beAB) bash-3.2$ tree
.
├── Pipfile
└── Pipfile.lock
0 directories, 2 files

(fisher-LZS5beAB) bash-3.2$ ls
Pipfile		Pipfile.lock


写回答

1回答

人笨嫌刀钝

2018-12-05

进入pipenv的shell后,直接 pip install flask 就好了

0
0

Python Flask高级编程之从0到1开发《鱼书》精品项目

7月老师深入浅出剖析Flask核心机制,和你一起探讨Python高级编程

2752 学习 · 1277 问题

查看课程