前言:安装jupyter notebookPython的软链接由Python2.7改成了Python3.7结果启动之前安装好的宝塔面板会报Error: BT-Panel service startup failed.错误。

错误信息如下

[root@wlinn ~]# /etc/init.d/bt
===============宝塔面板命令行==================
(1) 重启面板服务           (8) 改面板端口
(2) 停止面板服务           (9) 清除面板缓存
(3) 启动面板服务           (10) 清除登录限制
(4) 重载面板服务           (11) 取消入口限制
(5) 修改面板密码           (12) 取消域名绑定限制
(6) 修改面板用户名         (13) 取消IP访问限制
(7) 强制修改MySQL密码      (14) 查看面板默认信息
(22) 显示面板错误日志      (15) 清理系统垃圾
(23) 关闭BasicAuth认证     (16) 修复面板(检查错误并更新面板文件到最新版)
(24) 关闭谷歌认证          (17) 设置日志切割是否压缩
(0) 取消
===============================================
请输入命令编号:1
===============================================
正在执行(1)...
===============================================
Stopping Bt-Tasks...    done
Stopping Bt-Panel...    done
Starting Bt-Panel..........failed
------------------------------------------------------

[Traceback (most recent call last):
 File "/root/anaconda3/lib/python3.7/site-packages/gunicorn/util.py", line 135, in load_class
   mod = import_module('.'.join(components))
 File "/root/anaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
   return _bootstrap._gcd_import(name[level:], package, level)
 File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
 File "<frozen importlib._bootstrap>", line 983, in _find_and_load
 File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
 File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
 File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
 File "<frozen importlib._bootstrap>", line 983, in _find_and_load
 File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
 File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
 File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
 File "<frozen importlib._bootstrap>", line 983, in _find_and_load
 File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'geventwebsocket'
]

------------------------------------------------------
Error: BT-Panel service startup failed.


分析错误原因可能是升级python3后缺少了geventwebsocket这个模块

尝试下安装这个模块:

    pip install geventwebsocket

结果还是报错,错误信息比较长就不放上来了,仔细看找到了其中一条关键的信息raise Exception("You probably meant to install and run gevent-websocket")大概意思是您可能打算安装并运行gevent websocket

可能是上面那个写法不对,我又试了试如下命令

    pip install gevent-websocket

哎,安装上了试着重启一下,但又提示No module named 'paramiko'

好吧不急继续安装

    pip install paramiko

paramiko安装成功接着尝试重启

    Stopping Bt-Tasks...    done
    Stopping Bt-Panel...    done
    Starting Bt-Panel......    done
    Starting Bt-Tasks...     done

成功启动显示登录界面
bt

总结:python版本不一样,出现的问题也可能不一样,反正提示缺啥安装啥就是了

python2与python3共存可以参考下这篇文章

Last modification:May 3rd, 2021 at 05:27 pm