解决Linux下安装gunicorn提示-bash: gunicorn: command not found
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
免费下载资源
·
我在CentOS7下安装Python3之后踩坑:
[root@localhost ~]# pip3 install httpbin
[root@localhost ~]# pip3 install gunicorn
[root@localhost ~]# pip list
Package Version
------------ --------
...
gunicorn 19.9.0
httpbin 0.7.0
...
[root@localhost ~]#
[root@localhost ~]# gunicorn
-bash: gunicorn: 未找到命令
[root@localhost ~]#
解决办法
新建虚拟环境,在虚拟环境里面:
[root@localhost bin]# mkvirtualenv Py3_dev
Using base prefix '/usr/local/python3'
New python executable in /root/.virtualenvs/Py3_dev/bin/python3.7
Also creating executable in /root/.virtualenvs/Py3_dev/bin/python
Installing setuptools, pip, wheel...
done.
virtualenvwrapper.user_scripts creating /root/.virtualenvs/Py3_dev/bin/predeactivate
virtualenvwrapper.user_scripts creating /root/.virtualenvs/Py3_dev/bin/postdeactivate
virtualenvwrapper.user_scripts creating /root/.virtualenvs/Py3_dev/bin/preactivate
virtualenvwrapper.user_scripts creating /root/.virtualenvs/Py3_dev/bin/postactivate
virtualenvwrapper.user_scripts creating /root/.virtualenvs/Py3_dev/bin/get_env_details
(Py3_dev) [root@localhost bin]#
(Py3_dev) [root@localhost ~]# pip3 install httpbin
...
(Py3_dev) [root@localhost ~]# pip3 install gunicorn
...
(Py3_dev) [root@localhost ~]# gunicorn
usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: No application module specified.
(Py3_dev) [root@localhost ~]# gunicorn -b :80 httpbin:app
[2019-03-24 23:52:27 +0800] [18686] [INFO] Starting gunicorn 19.9.0
[2019-03-24 23:52:27 +0800] [18686] [INFO] Listening at: http://0.0.0.0:80 (18686)
[2019-03-24 23:52:27 +0800] [18686] [INFO] Using worker: sync
[2019-03-24 23:52:27 +0800] [18690] [INFO] Booting worker with pid: 18690
[2019-03-24 23:53:11 +0800] [18686] [CRITICAL] WORKER TIMEOUT (pid:18690)
[2019-03-24 23:53:11 +0800] [18690] [INFO] Worker exiting (pid: 18690)
[2019-03-24 23:53:11 +0800] [18727] [INFO] Booting worker with pid: 18727
^C[2019-03-24 23:53:29 +0800] [18686] [INFO] Handling signal: int
[2019-03-24 23:53:29 +0800] [18727] [INFO] Worker exiting (pid: 18727)
[2019-03-24 23:53:30 +0800] [18686] [INFO] Shutting down: Master
(Py3_dev) [root@localhost ~]#
后记
我也没搞清楚为啥只是在虚拟环境里面能成功。。。欢迎评论指出原因,感谢。
后记:
可以参考: Mac安装gunicorn成功,却无系统命令 https://blog.csdn.net/cq1113/article/details/78531688
推荐阅读:
python明明pip安装成功却找不到包 https://blog.csdn.net/qq_36376711/article/details/86292199
pip装了一个包,但是python里Import的时候找不到怎么办? https://blog.csdn.net/myknotruby/article/details/78911452
python pip 安装包后提示找不到的问题的解决 https://blog.csdn.net/u012955491/article/details/19782539/
Mac安装gunicorn成功,却无系统命令 https://blog.csdn.net/cq1113/article/details/78531688
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
已为社区贡献3条内容
所有评论(0)