Linux安装python3.6.1

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

 
 

 




以上是关于Linux安装python3.6.1的主要内容,如果未能解决你的问题,请参考以下文章

在Linux上安装Python3.6.1

linux 从Python 2.7升级至Python3.6.1

CentOS 7 安装python3.6.1

安装 readline 模块后 Python 3.6.1 崩溃

CentOS 7从Python 2.7升级至Python3.6.1

win7安装python3.6.1及scrapy