码迷,mamicode.com
首页 > 编程语言 > 详细

centOS7編譯安裝python

时间:2019-12-21 09:42:06      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:生成   pat   ssl   pre   文件   vim   libpcap   python36   roo   

1. 下載python3的原碼

//安裝依賴包
yum install gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y
//下載源碼包
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tgz

2. 解壓縮源碼包

tar -xvf Python-3.6.2.tgz

3. 編譯文件

cd Python*
//1. 釋放編譯文件makefile,這makefile就是用來編譯
    ./configure --prefix=/opt/python36/
//2. 開始編譯python3
    make
//3. 編譯且安裝(只有在這一步,才會生成/opt/python36/)
    make install
//4. 配置python3.6的環境變量
//    1. 配置軟鍊結
//    2. 配置path環境變量
echo $PATH查看環境變量
  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/java/jdk-11.0.4/bin:/root/bin
  
//編輯/etc/profile
vim /etc/profile
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/java/jdk-11.0.4/bin:/root/bin:/opt/python36/bin
source /etc/profile

 

完成

centOS7編譯安裝python

标签:生成   pat   ssl   pre   文件   vim   libpcap   python36   roo   

原文地址:https://www.cnblogs.com/jbite9057/p/12075822.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!