环境:CentOS 7 最新版(纯净)、Python2.7.5
相关文章《Centos python2.6.6 升级3.6.0》,建议看完本篇教程之后再安装BT面板。
Python2、Python3版共存,默认使用Python3。
不推荐在正式环境操作!!!
准备工作(非必需)
更新系统
1 |
yum -y update |
安装Python一些依赖包
1 |
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make python-devel |
一、安装Sqlite3
安装面板提示如下错误:
1 |
ModuleNotFoundError: No module named '_sqlite3' |
解决方法:
通过编译安装sqlite3,下载地址:https://www.sqlite.org/download.html
1 2 3 4 5 6 7 |
wget https://www.sqlite.org/snapshot/sqlite-snapshot-201907081345.tar.gz tar zxvf sqlite-snapshot-201907081345.tar.gz mkdir /usr/local/sqlite3 ./configure prefix=/usr/local/sqlite3 make && make install export LD_LIBRARY_PATH=/usr/local/sqlite3 添加环境变量 ln -s /usr/local/sqlite3/bin/sqlite3 /usr/bin/sqlite3 |
打开python安装源码的setup.py修改如下:
1 2 3 4 5 6 |
sqlite_inc_paths = [ '/usr/include', '/usr/local/sqlite3/include', #增加该部分内容 '/usr/include/sqlite', '/usr/include/sqlite3', '/usr/local/include', '/usr/local/include/sqlite', |
然后再编译安装Python3
二、安装setuptools
1 |
yum -y install python-setuptools |
有可能还需要pip安装setuptools(38.1),在写教程的时候具体操作有点忘了,建议安装一下。
1 |
pip install setuptools==38.1 |
三、安装gunicorn
错误提示:
1 |
pkg_resources.DistributionNotFound: The 'gunicorn==18.0' distribution was not found and is required by the application |
pip安装指定版本模块
1 |
pip install gunicorn==18.0 |
在安装面板前把上面的问题先解决再安装,应该就不会有问题了。
文章评论
宝塔现在确实做得不错了,国内很火啊,只是因为国内Linux会的人员太少了