解决Linux下安装gunicorn提示-bash: gunicorn: command not found

我在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


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值