我已经在PythonV2中使用web2py好几年了,现在我想切换到Python3运行时,但我不确定正确的方法是什么
我通常使用here提供的安装脚本安装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,如本link中所述,使用:
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一起运行
通过卸载一个版本的uwsgi pip包,安装另一个,然后重新启动服务,我们能够在web2py服务器上在python 2和python 3之间切换:
经过几天的搜索,我似乎发现了一些很容易实现的东西,并且正在我的案例中工作。感谢以下link
我安装了以下软件:
然后我在/usr/bin下列出了已安装的插件:
有两种:uwsgi_Python3和uwsgi_Python36,因此我使用:
重新启动服务器后,它工作正常:
也许有更好的(首选方式),但我不想添加虚拟环境,也不想更改默认的OS Python版本。这样,我就更新了uwsgi运行时
相关问题 更多 >
编程相关推荐