debian9 安裝 Python3.6.5

debian9 安裝 Python3.6.5

查看系統python版本python

python
Python 2.7.9 (default, Mar  1 2015, 18:22:53)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

1.更新軟件包linux

apt-get update
apt-get upgrade

2.安裝依賴包flask

aptitude -y install gcc make zlib1g-dev libffi-dev libssl-dev

若是提示-bash: aptitude: command not found,則表示你的機子須要安裝aptitude,安裝命令以下:bash

apt-get install aptitude

3.下載 Python 3.6.5ui

wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz

4.解壓壓縮包code

tar -xvf Python-3.6.5.tgz

5.受權文件夾權限orm

chmod -R +x Python-3.6.5

6.進入文件夾,並執行安裝配置ip

cd Python-3.6.5/
./configure

或者將python3安裝到其它目錄下ssl

./configure --prefix=/opt/python3.6.5

會提示如下信息get

If you want a release build with all optimizations active (LTO, PGO, etc), please run ./configure --enable-optimizations.

按照提示進行執行代碼,參考連接:http://stackoverflow.com/ques...

注意,若是按照提示執行了代碼,那麼剛纔設置的指定安裝路徑則無效,會安裝到 usr/local/bin 裏面。若是你只想用 python3 來執行 flask,那麼是否安裝到指定目錄,對你的目標並無影響。
./configure --enable-optimizations

7.安裝依賴包,

aptitude -y install  libffi-dev libssl-dev

8.編譯安裝

make && make install

顯示下面代碼則表示安裝成功

Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-9.0.1 setuptools-28.8.0

9.清理配置文件(有沒有必要進行這一步,我也不知道。)

make clean 
make distclean

10.添加快捷方式

# ln -s /opt/python3.6.5/bin/python3.6 /usr/bin/python3
# ln -s /opt/python3.6.5/bin/pip3.6 /usr/bin/pip3.6
# ln -s /opt/python3.6.5/bin/pip3 /usr/bin/pip3
# ln -s /opt/python3.6.5/bin/pyvenv-3.6 /usr/bin/pyvenv

end

相關文章
相關標籤/搜索