linux環境下安裝Python3 環境變數配置

2022-06-04 05:27:08 字數 1682 閱讀 8347

安裝依賴包

在安裝python之前需要先安裝依賴包

yum install gcc patch

yum install libffi-devel

yum install python-devel

yum install zlib-devel

yum install bzip2-devel

yum install openssl-devel

yum install ncurses-devel

yum install sqlite-devel

yum install readline-devel

yum install tk-devel

yum install gdbm-devel

yum install db4-devel

yum install libpcap-devel

yum install xz-devel -y

或者 

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
解壓檔案tar -xvzf python-3.5.1.tgz

配置編譯並安裝

首先cd到解壓目錄下

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

make

make install

警告make install

可以覆蓋或偽裝python3二進位制檔案。因此,建議使用make altinstall

而不是make install

,因為後者只安裝了exec_prefix

/bin/pythonversion

新增環境變數

vim /etc/profile

新增 /usr/local/python3/bin

export path="/usr/local/nginx/sbin/:/usr/local/python3/bin:$path"

source /etc/profile

或者參加軟鏈結

ln -s pip3.5 /usr/local/bin/pip3

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

在/etc/profile下配置好環境變數後,每次關閉shell視窗後都需要再執行一次source /etc/profile才能生效,這個問題需要在~/.bashrc檔案最後新增source /etc/profile,這樣問題便得到解決

大功告成

linux環境下Tomcat安裝

2.解壓tomcat到 usr local 下,執行tar zcvf apache tomcat 5.5.30.tar.gz 3.設定tomcat homel路徑.export tomcat home usr local apache tomcat 5.5.30 4.啟動tomcat,到tomcat...

linux環境下安裝nginx

目的 安裝nginx 環境 ubuntu server 14.03 效果 安裝 g apt get install g 我把檔案放在我自己的目錄裡 usr share myserver tools 進入該目錄 cd usr share myserver tools解壓 tar xzvf pcre 8...

linux下安裝python環境

1 linux下安裝python3 在安裝包中有乙個readme的檔案,裡面有寫如何安裝 tar jxvf python 3.5.0 tar.xz cd python 3.5.0 configure prefix usr local python3 make make install 做軟鏈 ln ...