CentOS7编译安装Python3.6.3

版权声明:本文为博主收集整理或者原创,觉得不错请点赞、评论加收藏 ,如若侵权请联系删除。 https://blog.csdn.net/qq_35590198/article/details/78410461

1、先解决依赖

# 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 wget
   
   
  • 1

2、wget Python3.6.3;创建程序目录;编译安装

# wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
# mkdir -p /usr/local/python3
# tar -zxvf Python-3.6.3.tgz
# cd Python-3.6.3/
# ./configure --prefix=/usr/local/python3 && make && make install
   
   
  • 1
  • 2
  • 3
  • 4
  • 5

如无意外,则会安装完成,如有意外,请自行度娘解决!!!
3、建立Python3的软链接,并将/usr/local/python3/bin加入bash_profile

# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
# vim ~/.bash_profile
   
   
  • 1
  • 2
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs
##下面这句为添加内容
PATH=$PATH</span>:<span class="hljs-variable">$HOME/bin:/usr/local/python3/bin

PATH=$PATH</span>:<span class="hljs-variable">$HOME/bin

export PATH
   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

然后

# source ~/.bash_profile
   
   
  • 1

查看Python3.6.3 pip3是否正常

# python3 -V
Python 3.6.3
# pip3 -V
pip 9.0.1 from /usr/local/python3/lib/python3.6/site-packages (python 3.6)
   
   
  • 1
  • 2
  • 3
  • 4

至此,Python3.6.3安装完毕,如出现其他错误可在评论区留言指出。



版权声明:本文为博主收集整理或者原创,觉得不错请点赞、评论加收藏 ,如若侵权请联系删除。 https://blog.csdn.net/qq_35590198/article/details/78410461

1、先解决依赖

# 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 wget
 
 
  • 1

2、wget Python3.6.3;创建程序目录;编译安装

# wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
# mkdir -p /usr/local/python3
# tar -zxvf Python-3.6.3.tgz
# cd Python-3.6.3/
# ./configure --prefix=/usr/local/python3 && make && make install
 
 
  • 1
  • 2
  • 3
  • 4
  • 5

如无意外,则会安装完成,如有意外,请自行度娘解决!!!
3、建立Python3的软链接,并将/usr/local/python3/bin加入bash_profile

# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
# vim ~/.bash_profile
 
 
  • 1
  • 2
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs
##下面这句为添加内容
PATH=$PATH</span>:<span class="hljs-variable">$HOME/bin:/usr/local/python3/bin

PATH=$PATH</span>:<span class="hljs-variable">$HOME/bin

export PATH
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

然后

扫描二维码关注公众号,回复: 3568716 查看本文章
# source ~/.bash_profile
 
 
  • 1

查看Python3.6.3 pip3是否正常

# python3 -V
Python 3.6.3
# pip3 -V
pip 9.0.1 from /usr/local/python3/lib/python3.6/site-packages (python 3.6)
 
 
  • 1
  • 2
  • 3
  • 4

至此,Python3.6.3安装完毕,如出现其他错误可在评论区留言指出。

猜你喜欢

转载自blog.csdn.net/qw943571775/article/details/82686867