博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Flask CLI抛出'OSError:[Errno 8] Exec格式错误'
阅读量:5039 次
发布时间:2019-06-12

本文共 2940 字,大约阅读时间需要 9 分钟。

这个是报错 运行的时候出现的

/home/python/.virtualenvs/flask_dome/bin/python3.6 /home/python/Desktop/flask_demo_01/app.py * Serving Flask app "app" (lazy loading) * Environment: production   WARNING: Do not use the development server in a production environment.   Use a production WSGI server instead. * Debug mode: on * Running on http://192.168.0.140:8888/ (Press CTRL+C to quit) * Restarting with statTraceback (most recent call last):  File "/home/python/Desktop/flask_demo_01/app.py", line 79, in 
app.run(host='192.168.0.140',port=8888) File "/home/python/.virtualenvs/flask_dome/lib/python3.6/site-packages/flask/app.py", line 943, in run run_simple(host, port, self, **options) File "/home/python/.virtualenvs/flask_dome/lib/python3.6/site-packages/werkzeug/serving.py", line 988, in run_simple run_with_reloader(inner, extra_files, reloader_interval, reloader_type) File "/home/python/.virtualenvs/flask_dome/lib/python3.6/site-packages/werkzeug/_reloader.py", line 332, in run_with_reloader sys.exit(reloader.restart_with_reloader()) File "/home/python/.virtualenvs/flask_dome/lib/python3.6/site-packages/werkzeug/_reloader.py", line 176, in restart_with_reloader exit_code = subprocess.call(args, env=new_environ, close_fds=False) File "/usr/lib/python3.6/subprocess.py", line 267, in call with Popen(*popenargs, **kwargs) as p: File "/usr/lib/python3.6/subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename)OSError: [Errno 8] Exec format error: '/home/python/Desktop/flask_demo_01/app.py'

原因及解决办法:

这是Werkzeug 0.15中的一种新行为。降级到Werkzeug 0.14.1。

卸载 

(flask_dome) python@ubuntu:~/Desktop/house_bjweb$ pip install WerkzeugRequirement already satisfied: Werkzeug in /home/python/.virtualenvs/flask_dome/lib/python3.6/site-packages (0.15.0)

安装

(flask_dome) python@ubuntu:~/Desktop/house_bjweb$ pip install Werkzeug==0.14.1Collecting Werkzeug==0.14.1  Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)     |████████████████████████████████| 327kB 12kB/s Installing collected packages: Werkzeug  Found existing installation: Werkzeug 0.15.0    Uninstalling Werkzeug-0.15.0:      Successfully uninstalled Werkzeug-0.15.0Successfully installed Werkzeug-0.14.1

 

运行成功:

/home/python/.virtualenvs/flask_dome/bin/python3.6 /home/python/Desktop/flask_demo_01/app.py * Serving Flask app "app" (lazy loading) * Environment: production   WARNING: Do not use the development server in a production environment.   Use a production WSGI server instead. * Debug mode: on * Running on http://192.168.0.140:8888/ (Press CTRL+C to quit) * Restarting with stat * Debugger is active! * Debugger PIN: 264-574-474

 

转载于:https://www.cnblogs.com/Xingtxx/p/11097331.html

你可能感兴趣的文章
解密浏览器缓存机制
查看>>
Apache服务器的安装与配置
查看>>
登陆工程
查看>>
实用的ES6特性
查看>>
通过id设置的css属性和通过元素设置的css属性冲突了,优先级哪个高?
查看>>
python将两个数组合并成一个数组的两种方法的代码
查看>>
Java基础8-浅谈java程序的运行机制与JVM运行
查看>>
MyBatis之级联——鉴别器
查看>>
javascript:void(0)的含义
查看>>
解决android启动程序时,会出现一个短暂的白色空白界面的问题
查看>>
BZOJ‘s Usaco 奶牛题集锦
查看>>
生成器
查看>>
drf权限组件
查看>>
输入月份和日期,得出是今年第几天
查看>>
利用mysqldump备份mysql
查看>>
Qt中子窗口全屏显示与退出全屏
查看>>
使用brew安装软件
查看>>
[BZOJ1083] [SCOI2005] 繁忙的都市 (kruskal)
查看>>
吴裕雄 python 机器学习——数据预处理嵌入式特征选择
查看>>
Centos6.4安装JDK
查看>>