python3.6 linux 安裝

[hilqiqi0@crawler-001 data2]$ sudo mkdir python3.6
[hilqiqi0@crawler-001 data2]$ cd python3.6/
[hilqiqi0@crawler-001 python3.6]$ sudo wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
[hilqiqi0@crawler-001 python3.6]$ sudo tar -zxvf Python-3.6.8.tgz
[hilqiqi0@crawler-001 python3.6]$ cd Python-3.6.8
[hilqiqi0@crawler-001 Python-3.6.8]$ cd Python-3.6.8

# 指定python3的安裝路徑
[hilqiqi0@crawler-001 Python-3.6.8]$ sudo ./configure --prefix=/usr/local/python3
[hilqiqi0@crawler-001 Python-3.6.8]$ sudo make
[hilqiqi0@crawler-001 Python-3.6.8]$ sudo make install

# 安裝報錯:zipimport.ZipImportError: can't decompress data; zlib not available make: *** [install] Error 1
# 解決方法:安裝zlib*,並
# [hilqiqi0@crawler-001 Python-3.6.8]$ sudo yum -y install zlib*
# [hilqiqi0@crawler-001 Python-3.6.8]$ sudo make install

# pip is configured with locations that require TLS/SSL
# sudo yum install  gcc libffi-devel zlib* openssl-devel
# sudo ./configure --prefix=/usr/local/python3
# sudo make clean 
# sudo make 
# sudo make install


# 指定軟連接
[hilqiqi0@crawler-001 Python-3.6.8]$ sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3

# 配置環境PATH
[hilqiqi0@crawler-001 Python-3.6.8]$ vim .bash_profile
# export PATH前一行添加這一句:PATH=$PATH:$HOME/bin:/usr/local/python3/bin

# 使環境PATH生效
[hilqiqi0@crawler-001 Python-3.6.8]$ source ~/.bash_profile


[hilqiqi0@crawler-001 python3.6]$ python3 -V
Python 3.6.8
[hilqiqi0@crawler-001 python3.6]$ pip3 -V
pip 18.1 from /usr/local/python3/lib/python3.6/site-packages/pip (python 3.6)


# 若pip3無反應,就手動建立軟連接
# sudo ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章