- 从源码编译安装 python3.8
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel gcc make
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0b3.tgz
tar -xvf Python-3.8.0b3.tgz
cd Python-3.8.0b3
./configure --prefix=/app/python/python3.8
make & make install
ln -s /app/python/python3.8/bin/python3.8 /usr/bin/python3.8
ln -s /app/python/python3.8/bin/pip3.8 /usr/bin/pip3.8
- 安装 mycli
pip3.8 install mycli
- 安装完后, 直接运行, 报错:
Traceback (most recent call last):
File "/usr/bin/mycli", line 7, in <module>
from mycli.main import cli
File "/usr/lib/python2.7/site-packages/mycli/main.py", line 18, in <module>
from cli_helpers.tabular_output import TabularOutputFormatter
File "/usr/lib/python2.7/site-packages/cli_helpers/tabular_output/__init__.py", line 11, in <module>
from .output_formatter import format_output, TabularOutputFormatter
File "/usr/lib/python2.7/site-packages/cli_helpers/tabular_output/output_formatter.py", line 7, in <module>
from cli_helpers.compat import (text_type, binary_type, int_types, float_types,
File "/usr/lib/python2.7/site-packages/cli_helpers/compat.py", line 37, in <module>
from pygments.formatters.terminal256 import Terminal256Formatter
File "/usr/lib/python2.7/site-packages/pygments/formatters/terminal256.py", line 31, in <module>
from pygments.style import ansicolors
File "/usr/lib/python2.7/site-packages/pygments/style.py", line 171
class Style(metaclass=StyleMeta):
解决:
vim /usr/bin/mycli
- 修改前 #!/usr/bin/python2
- 修改后 #!/usr/bin/python3.8
网友评论