首頁 > 軟體

Linux安裝Python 3.5.2

2020-06-16 17:04:54

安裝依賴的庫

yum -y install Python-devel openssl openssl-devel gcc sqlite sqlite-devel mysql-devel libxml2-devel libxslt-devel

Python =================================================

下載python 3.5.2

www.python.org

解壓檔案

tar -xzf Python-3.5.2.tgz

進入目錄

cd Python-3.5.2

編譯安裝

./configure --prefix=/usr/local/python3.5 --with-threads --enable-shared  
make && make altinstall

備份舊python相關命令

mv /usr/bin/pip /usr/bin/pip_old
mv /usr/bin/easy_install /usr/bin/easy_install_old
mv /usr/bin/python /usr/bin/python_old

新版本python命令做軟連線,快捷使用

ln -s /usr/local/python3.5/lib/libpython3.5m.so /usr/lib  
ln -s /usr/local/python3.5/lib/libpython3.5m.so.1.0 /usr/lib
ln -s /usr/local/python3.5/lib/libpython3.5m.so /usr/lib64  
ln -s /usr/local/python3.5/lib/libpython3.5m.so.1.0 /usr/lib64  
ln -s /usr/local/python3.5/bin/python3.5 /usr/bin/python  
ln -s /usr/local/python3.5/bin/easy_install-3.5 /usr/bin/easy_install  
ln -s /usr/local/python3.5/bin/pip3.5 /usr/bin/pip

重新載入設定

/sbin/ldconfig -v

盡情使用吧~~!


本文永久更新連結地址http://www.linuxidc.com/Linux/2017-10/147579.htm

IT145.com E-mail:sddin#qq.com