flask run
在新的conda env中尝试时不起作用,但在较旧的conda env中可以正常工作。
我已经删除并重新创建了new-env
,并重新安装了具有相同版本1.0.3的烧瓶。
(new-env) C:\Users\myname\PycharmProjects\myproject\backend>set FLASK_APP=my_app.py
(new-env) C:\Users\myname\PycharmProjects\myproject\backend>set FLASK_DEBUG=1
(new-env) C:\Users\myname\PycharmProjects\myproject\backend>flask run
* Serving Flask app "my_app.py" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Restarting with stat
c:\users\myname\anaconda3\envs\new-env\python.exe: No module named C:\Users\myname\Anaconda3\envs\new-env\Scripts\flask
切换到较旧的conda env:
(old-env) C:\Users\myname\PycharmProjects\myproject\backend>flask run
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)