ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

ubuntu 同时安装python2 和 python3 版本的 gunicorn

2021-12-21 13:34:33  阅读:260  来源: 互联网

标签:gunicorn pip3 pip2 ubuntu 安装 gunicorn3 python3 python2


前言

最近在学习使用 gunicorn 部署 flask 项目。发现使用 pip3 安装完 gunicorn后,如如果再使用 pip2 安装 gunicorn,后安装的 gunicorn 就会覆盖掉原来的,现在将我的解决方案记录一下,留作参考使用。

解决方案

  1. 卸载全部 gunicorn
    pip2 uninstall gunicorn
    pip3 uninstall gunicorn

  2. 安装 python3 版本的 gunicorn
    (1). pip3 install gunicorn
    (2). 使用 whereis gunicorn 找到 gunicorn 的位置,我的是在 /usr/local/bin/gunicorn.
    (3). 然后进入到这个目录,重命名 gunicorn: mv gunicorn gunicorn3
    (4). 在终端输入gunicorn3 -h,调用成功,即表示更改成功

  3. 安装 python2 版本的 gunicorn
    (1). pip2 install gunicorn
    (2). 安装完成后,会发现输入 gunicorn + Tab键,gunicorn、gunicorn3同时存在
    (3). 在终端输入gunicorn -h,调用成功,即表示安装成功

至此,全部安装完毕,使用 gunicorn3 默认调用 python3,使用 gunicorn 默认调用 python2
注:如果重新安装python2 的 pip 工具,可以参考https://www.cnblogs.com/brian-sun/p/14549474.html

标签:gunicorn,pip3,pip2,ubuntu,安装,gunicorn3,python3,python2
来源: https://www.cnblogs.com/brian-sun/p/15714850.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有