debian9 安装 Python3.6.5

发布时间:2019-06-22 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了debian9 安装 Python3.6.5脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

Debian9 安装 Python3.6.5

查看系统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.
@H_304_49@>>>

1.更新软件包

apt-get update
apt-get upgrade

2.安装依赖包

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

如果提示-bash: aptitude: command not found,则表示你的机子需要安装aptitude,安装命令如下:

apt-get install aptitude

3.下载 Python 3.6.5

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

4.解压压缩包

tar -xvf Python-3.6.5.tgz

5.授权文件夹权限

chmod -R +x Python-3.6.5

6.进入文件夹,并执行安装配置

cd Python-3.6.5/
./configure

或者python3安装到其它目录下

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

会提示以下信息

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

脚本宝典总结

以上是脚本宝典为你收集整理的debian9 安装 Python3.6.5全部内容,希望文章能够帮你解决debian9 安装 Python3.6.5所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。