我已经将web2py与Python v2一起使用了几年,现在我想切换到Python 3运行时,但是我不确定什么是正确的方法?
我通常使用从此处提供的安装脚本来安装web2py ,它在Ubuntu 18.04下运行。
djordje@vmi:~$ python --version
Python 2.7.17
djordje@vmi:~$ python3 --version
Python 3.6.9
djordje@vmi:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
我尝试将默认Python版本设置为3,如以下链接上所述,使用:
update-alternatives --remove python /usr/bin/python2
update-alternatives --install /usr/bin/python python /usr/bin/python3 10
并将默认Python设置为v3,但即使在重新启动服务器后-web2py仍可在Python v2上运行。
Version
2.18.5-stable+timestamp.2019.04.08.04.22.03
(Running on nginx/1.14.0, Python 2.7.17)
有没有建议的方法来将web2py设置为在Linux上与Python 3一起运行?
经过几天的搜索,似乎我发现了一些易于实现的东西,并且在我的情况下可以正常工作。感谢以下链接。
我安装了以下内容:
apt install uwsgi-plugin-python3
然后在/ usr / bin下列出了已安装的插件:
ls /usr/bin/uwsgi_python*
有两个:uwsgi_python3和uwsgi_python36,所以我使用了:
update-alternatives --set uwsgi /usr/bin/uwsgi_python36
重启服务器后,它可以正常工作:
2.18.5-stable+timestamp.2019.04.08.04.22.03
(Running on nginx/1.14.0, Python 3.6.9)
也许有更好的方法(首选方法),但是我不想添加虚拟环境,也不想更改默认的OS Python版本。这样,我刚刚更新了uwsgi运行时。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句