Linux安装python3.6.1

转自:http://www.cnblogs.com/kimyeee/p/7250560.html

1.环境准备,安装zlib-devel和openssl-devel等

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

2.下载安装

wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

mkdir -p /usr/local/python3

tar -zxvf Python-3.6.1.tgz

./configure --prefix=/usr/local/python3

make && make install

3.建立软连接

ln -s /usr/local/python3/bin/python3 /usr/bin/python3

4.加入PATH环境变量

# vim ~/.bash_profile

# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

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

export PATH

然后ESC, wq:退出

source ~/.bash_profile

5.测试

python3 -V

6.安装pip

环境:

  setuptools

  

  wget --no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26

  tar -zxvf setuptools-19.6.tar.gz

  cd setuptools-19.6

  python3 setup.py build

  python3 setup.py install

  开始安装

  

  wget --no-check-certificate  https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb

  tar -zxvf pip-8.0.2.tar.gz

  cd pip-8.0.2

  python3 setup.py build

  python3 setup.py install

  测试:pip3 install paramiko

 
 
是什么让你疯狂?
原文地址:https://www.cnblogs.com/iforelse/p/7852347.html