centos7下python3环境搭建

2019-09-27  本文已影响0人  叽咯

whereis python

python: /usr/bin/python /usr/bin/python2.7 /usr/lib/python2.7 /usr/lib64/python2.7 /etc/python /usr/include/python2.7 /usr/share/man/man1/python.1.gz

ll /usr/bin/python*

lrwxrwxrwx 1 root root    7 Aug 28 19:41 /usr/bin/python -> python2
lrwxrwxrwx 1 root root    9 Aug 28 19:41 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 7216 Jun 21 04:28 /usr/bin/python2.7

安装python3的依赖

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

添加epel扩展源

yum -y install epel-release

安装pip

yum -y install python-pip
pip install wget

提示更新pip

pip install --upgrade pip

下载python包

tar -zxvf Python-3.7.4.tgz
./configure prefix=/usr/local/python3
make && make install

3.7以上版本有编译错误,需要安装一个依赖

yum install libffi-devel -y
make install
whereis python3

符号链接的复制:cp -d

新建符号链接 ln -s

上一篇下一篇

猜你喜欢

热点阅读