wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz tar -zxvf Python-2.7.15.tgz cd Python-2.7.15 ./configure --prefix=/usr/local make all make altinstall make clean
创建软连接
1
ln -s /usr/local/bin/python2.7 /usr/bin/python
修改 yum
1
vi /usr/bin/yum
将第一行 #!/usr/bin/python 改为 #!/usr/bin/python2.6
安装 setuptools
1 2 3 4
wget https://files.pythonhosted.org/packages/1d/64/a18a487b4391a05b9c7f938b94a16d80305bf0369c6b0b9509e86165e1d3/setuptools-41.0.1.zip unzip setuptools-41.0.1.zip cd setuptools-41.0.1 python setup.py install
安装 pip
1 2 3 4
wget https://files.pythonhosted.org/packages/51/5f/802a04274843f634469ef299fcd273de4438386deb7b8681dd059f0ee3b7/pip-19.1.tar.gz tar -xvf pip-19.1.tar.gz cd pip-19.1 python setup.py install
修改 pip
1 2 3
File "/usr/bin/pip", line 7, in <module> from pip import main ImportError: cannot import name main
更新 pip
1
vi /usr/bin/pip
将from pip import main改为from pip import __main__,
sys.exit(_main())改为sys.exit(__main__._main())
最终得到:
1 2 3 4 5 6 7
#!/usr/bin/python
import sys from pip import __main__
if __name__ == '__main__': sys.exit(__main__._main())
三. 宝塔面板相关问题
出现您请求的页面因发生异常而中断!,按照下述处理:
宝塔日志
1
cat /tmp/panelBoot.pl
宝塔需要的启动环境
1 2
pip install psutil pip install web.py
挂载硬盘
1 2
fdisk -l # 查看硬盘信息 mount /dev/vdb5 /storage
定时任务需要的 python 环境
1
pip install mysql-python
启动 xxl 定时任务
1 2 3
cd /storage/admin.lisongqian.cn java -jar xxl-job-admin-2.0.1.jar & java -jar xxl-job-executor-sample-springboot-2.0.1.jar &