安装python3_Linux-安装python3环境

Linux-安装python3环境

[root@node1 ~]# yum -y groupinstall "Development tools"

[root@node1 ~]# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

[root@node1 ~]# wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

[root@node1 ~]# mkdir -p /usr/local/python3

[root@node1 ~]# tar -zxf Python-3.6.1.tgz

[root@node1 ~]# cd Python-3.6.1[root@node1 Python-3.6.1]#

[root@node1 Python-3.6.1]#

[root@node1 Python-3.6.1]# ls

aclocal.m4 configure Grammar Lib Makefile.pre.inObjects PCbuild Python Tools

config.guess configure.ac Include LICENSE Misc Parser Programs README.rst

config.sub Doc install-sh Mac Modules PC pyconfig.h.in setup.py

[root@node1 Python-3.6.1]# ./configure --prefix=/usr/local/python3

[root@node1 Python-3.6.1]# make && make install

[root@node1 Python-3.6.1]# ln -s /usr/local/python3/bin/python3 /usr/bin/python3

[root@node1 Python-3.6.1]# vim ~/.bash_profile

# .bash_profile

# Get the aliases and functionsif [ -f ~/.bashrc ]; then

.~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/python3/bin

export PATH

[root@node1 Python-3.6.1]# source ~/.bash_profile

[root@node2 Python-3.6.1]# pip3 install --upgrade pip

Collecting pip

Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)

100% |████████████████████████████████| 1.4MB 155kB/s

Installing collected packages: pip

Found existing installation: pip9.0.1Uninstalling pip-9.0.1:

Successfully uninstalled pip-9.0.1Successfully installed pip-19.1.1

[root@node1 Python-3.6.1]# python3 -V

Python 3.6.1

[root@node1 Python-3.6.1]# pip3 -V

pip 19.1.1 from /usr/local/python3/lib/python3.6/site-packages/pip (python 3.6) #这里如果没有显示不用执行下面命令

[root@node1 Python-3.6.1]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

这样就安装完成了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值