Ubuntu 16.04 LTS中源码安装Python 3.6.0的方法教程
作者:daisy 时间:2021-10-19 05:05:53
前提
官网上提供了 Mac 和 Windows 上的安装包和 Linux 上安装需要的源码。
下载地址如下:
https://www.python.org/downloads/release/python-360/
安装
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
xz -d Python-3.6.0.tar.xz
tar -xvf Python-3.6.0.tar
cd Python-3.6.0
./configure
make
sudo make install
测试:
$ python3.6 --version
Python 3.6.0
测试几个新的语法特性:
1.
# Formatted string literals
>>> name = 'Ray'
>>> f"Hello {name}."
'Hello Ray.'
效果相当于
>>> name = 'Ray'
>>> "Hello {name}.".format(name=name)
'Hello Ray.'
2.
# Underscores in Numeric Literals
>>> a = 1_000_000_000_000_000
>>> a
1000000000000000
>>> '{:_}'.format(1000000)
'1_000_000''1_000_000'
3.
# Enum.auto
>>> from enum import Enum, auto
>>> class Color(Enum):
... red = auto()
... blue = auto()
... green = auto()
...
>>> list(Color)
[<Color.red: 1>, <Color.blue: 2>, <Color.green: 3>]
Tips
第一次编译安装之后,有可能会发现输入python3.6 之后,方向键失效。
原因是 readline 库没有安装。
解决方式:
安装 readline 库
sudo apt-get install libreadline-dev
安装之后,再将 python 重新编译安装一次。
cd Python-3.6.0
./configure
make
sudo make install
总结
标签:ubuntu,python,安装
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
网页效果图设计之色彩索引
2008-03-23 13:53:00
![](https://img.aspxhome.com/file/UploadPic/up/2008032314313926.gif)
谈PHP生成静态页面分析 模板+缓存+写文件
2023-11-14 12:44:39
Keras目标检测mtcnn facenet搭建人脸识别平台
2023-09-28 07:02:01
![](https://img.aspxhome.com/file/2023/8/90838_0s.png)
如何基于Python实现数字类型转换
2023-10-08 00:57:13
python 实现图片特效处理
2021-04-20 05:34:22
![](https://img.aspxhome.com/file/2023/5/81595_0s.png)
python实现查询IP地址所在地
2021-09-08 17:18:43
![](https://img.aspxhome.com/file/2023/3/95503_0s.jpg)
Python‘==‘ 及 ‘is‘相关原理解析
2021-10-11 15:16:59
Python入门之集合的使用教程
2022-10-31 13:44:45
浅析SQL Server 2008企业级新特性
2008-11-24 17:01:00
PHP字符串中提取文件名的实例方法
2023-06-12 18:57:32
python 3.10上如何安装pyqt5
2022-04-09 23:59:53
![](https://img.aspxhome.com/file/2023/6/81866_0s.png)
python关于变量名的基础知识点
2023-07-27 14:21:43
Python+seaborn实现联合分布图的绘制
2022-06-14 01:23:53
![](https://img.aspxhome.com/file/2023/2/99442_0s.png)
设计和企业文化
2009-03-28 10:35:00
使用IDLE的Python shell窗口实例详解
2021-04-15 16:49:09
![](https://img.aspxhome.com/file/2023/7/97537_0s.png)
利用python为PostgreSQL的表自动添加分区
2023-07-07 14:44:58
python二分查找算法的递归实现方法
2023-05-12 23:22:48
Python文件基本操作实用指南
2022-05-05 23:22:28
![](https://img.aspxhome.com/file/2023/1/112151_0s.png)
Python简单实现阿拉伯数字和罗马数字的互相转换功能示例
2021-08-29 08:52:57
![](https://img.aspxhome.com/file/2023/4/79794_0s.png)
Python实现手写一个类似django的web框架示例
2022-06-18 03:17:26
![](https://img.aspxhome.com/file/2023/9/65049_0s.png)