CentOS 7升级Python3,然后安装Mycli

语言: CN / TW / HK

0.查看系统版本

	cat /etc/redhat-release
CentOS Linux release 7.8.2003 (Core)

1.配置阿里pip仓库

	 mkdir ~/.pip/
	 cat > ~/.pip/pip.conf <<EOF
	 [global]
	 index-url = https://mirrors.aliyun.com/pypi/simple/
	 
	 [install]
	 trusted-host=mirrors.aliyun.com
	 EOF

2.升级python

	yum -y install libffi-devel zlib* python-devel openssl-devel
	tar -zxf Python-3.9.0.tgz
	cd Python-3.9.0/
	./configure --prefix=/usr/local/python --with-ssl
	make && make install 

3.创建链接,提升易用性

	ln -s /usr/local/python/bin/python3 /usr/bin/
 	sed -i '/^PATH/s#$#:/usr/local/python/bin#' ~/.bash_profile
 	source ~/.bash_profile
	echo $PATH

4.安装、启动mycli

	pip3 install mycli
	systemctl status mariadb
	mycli
	# 运行mycli报错的话可以改一下执行器
	# sed -i 's/python/python3/' /usr/bin/mycli
分享到: