源碼安裝python3

****你們好,我是霸王卸甲,很長時間沒更新博客了,今天給你們帶來的是centos python3的源碼安裝教程!!!!!python

python官網:https://www.python.org/sql

下載python3的包centos

裝好yum源和epel源編輯器

解壓安裝ide

[root@localhost a]# ls
Python-3.6.0.tgz
[root@localhost a]# tar -xf Python-3.6.0.tgz -C /usr/local/src/
[root@localhost a]# cd /usr/local/src/
[root@localhost src]# ls
Python-3.6.0
[root@localhost src]# cd Python-3.6.0/
[root@localhost Python-3.6.0]# sed -i 's/^#readline/readline/' Modules/Setup.dist
[root@localhost Python-3.6.0]# sed -ri 's/^#(_ssl)/\1/p' Modules/Setup.dist
[root@localhost Python-3.6.0]# sed -ri 's/^#([\t]-DUSE)/\1/p' Modules/Setup.dist
[root@localhost Python-3.6.0]# sed -ri 's/^#([\t]
-L\$(SSL))/\1/p' Modules/Setup.dist測試

[root@localhost Python-3.6.0]# 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 gcc code

[root@localhost Python-3.6.3]# ./configure --enable-shared --enable-optimizationssqlite

[root@localhost Python-3.6.3]# make -j 2 && make install
(-j 是cpu個數)教程

配置共享庫文件ip

  1. 先找到這個文件的安裝路徑

image-20180420113551605

  1. 爲全部用戶設置共享庫目錄

    用 vi 編輯器打開配置文件 /etc/profile

    vi /etc/profile

    在文件末尾寫上以下內容:

python3.6共享目錄
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

測試python3

image-20180420113524843

輸入 exit() 便可退出 python3.6

以上就是安裝python的過程了,你們能夠試一試,有問題即便給我留言,謝謝你們!!!!

相關文章
相關標籤/搜索