mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
PRF&PUB:20170609 Python 3.6 - install latest version into Linux Mint.md
@geekpi
This commit is contained in:
parent
b4ad348125
commit
eceeba19cf
@ -0,0 +1,81 @@
|
|||||||
|
Linux 上如何安装并切换最新版本的 Python 3.6
|
||||||
|
============================================================
|
||||||
|
|
||||||
|
![Python 3.6 - install latest version into Linux Mint](https://mintguide.org/uploads/posts/2017-06/1496865727_python-logo.png)
|
||||||
|
|
||||||
|
**Python** 是 [Linux][3] 中一种最流行的编程语言。它被写成了各种工具和库。除此之外,Python 在开发者之间很流行因为它非常简单,并且实际很容易掌握。如果你安装了 [Linux mint][4] 系统,正在学习 **Python** 并想要使用最新的版本的话,那么这篇文章就是为你而写的。现在我已经安装好了 [Linux Mint 18][5]。默认安装的版本是 2.7 和 3.5。你可以用这个命令检查:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ python -V
|
||||||
|
$ python2 -V
|
||||||
|
$ python3 -V
|
||||||
|
```
|
||||||
|
|
||||||
|
**安装最新的 Python 3.6 到 Linux 中**:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo add-apt-repository ppa:jonathonf/python-3.6
|
||||||
|
$ sudo apt update
|
||||||
|
$ sudo apt install python3.6
|
||||||
|
```
|
||||||
|
|
||||||
|
检查已安装的 Python 3.6 版本
|
||||||
|
|
||||||
|
```
|
||||||
|
$ python3.6 -V
|
||||||
|
```
|
||||||
|
|
||||||
|
**请注意**旧版本仍然还在,它仍然可以通过 `python3` 可用,新的版本可以通过命令 `python3.6`。如果你想要默认使用这个版本而不是 3.5 运行所有的程序,这有个工具叫 `update-alternatives`。但是如果你尝试获取可能的列表,我们会得到错误:
|
||||||
|
|
||||||
|
[![Python 3.6 - install latest version into Linux Mint](https://mintguide.org/uploads/posts/2017-06/thumbs/1496871711_linux_mint_001.png)][6]
|
||||||
|
|
||||||
|
这是正常的,你首先需要为那个问题设置文件,因为维护者没有设置这个:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
|
||||||
|
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
|
||||||
|
```
|
||||||
|
|
||||||
|
现在再次查看:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ update-alternatives --list python3
|
||||||
|
```
|
||||||
|
|
||||||
|
[![Python 3.6 - install latest version into Linux Mint](https://mintguide.org/uploads/posts/2017-06/thumbs/1496871720_linux_mint_002.png)][7]
|
||||||
|
|
||||||
|
现在我们选择需要的版本并按需切换。对于设置使用配置命令:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo update-alternatives --config python3
|
||||||
|
```
|
||||||
|
|
||||||
|
[![Python 3.6 - install latest version into Linux Mint](https://mintguide.org/uploads/posts/2017-06/thumbs/1496871722_linux_mint_003.png)][8]
|
||||||
|
|
||||||
|
在提示符中,你需要指定默认使用的编号。
|
||||||
|
|
||||||
|
> 选择版本时要小心,不要去动 python(python2),只使用我说的 python3,Python 2.7 编写了各种系统工具,如果你尝试用错误的解释器版本运行它们,可能就不会工作。
|
||||||
|
|
||||||
|
愿原力与你同在,好运!!!
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://mintguide.org/other/794-python-3-6-install-latest-version-into-linux-mint.html
|
||||||
|
|
||||||
|
作者:[Shekin][a]
|
||||||
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]:https://mintguide.org/user/Shekin/
|
||||||
|
[1]:http://www.codeweavers.com/?ad=708
|
||||||
|
[2]:https://mintguide.org/engine/dude/index/leech_out.php?a%3AaHR0cHM6Ly93d3cucHl0aG9uLm9yZw%3D%3D
|
||||||
|
[3]:https://mintguide.org/
|
||||||
|
[4]:https://mintguide.org/
|
||||||
|
[5]:https://mintguide.org/
|
||||||
|
[6]:https://mintguide.org/uploads/posts/2017-06/1496871711_linux_mint_001.png
|
||||||
|
[7]:https://mintguide.org/uploads/posts/2017-06/1496871720_linux_mint_002.png
|
||||||
|
[8]:https://mintguide.org/uploads/posts/2017-06/1496871722_linux_mint_003.png
|
||||||
|
[9]:https://mintguide.org/engine/dude/index/leech_out.php?a%3AaHR0cHM6Ly93d3cucHl0aG9uLm9yZw%3D%3D
|
||||||
|
[10]:https://mintguide.org/other/
|
@ -1,66 +0,0 @@
|
|||||||
Python 3.6 - 安装最新的版本到 Linux Mint 中
|
|
||||||
============================================================
|
|
||||||
|
|
||||||
|
|
||||||
![Python 3.6 - install latest version into Linux Mint](https://mintguide.org/uploads/posts/2017-06/1496865727_python-logo.png)
|
|
||||||
**Python** 是 [Linux][3] 中一种最流行的编程语言。它被写成了不同的工具和库。除此之外,Python 在开发者之间很流行因为它非常简单,并且实际很容易掌握。[][1]如果你安装了[Linux mint][4] 系统,另外你正在学习 **Python** 并想要使用最新的版本,那么这篇文章就是为你而写的。现在我已经安装了 [Linux Mint 18][5]。默认安装的版本是 2.7 和 3.5。你可以用这个命令检查:
|
|
||||||
|
|
||||||
```
|
|
||||||
TerminalShekin@mylinuxmintpc~$python -V
|
|
||||||
python2 -V
|
|
||||||
python3 -V
|
|
||||||
```
|
|
||||||
**安装最新的 Python 3.6 到 Linux 中**:
|
|
||||||
|
|
||||||
```
|
|
||||||
TerminalShekin@mylinuxmintpc~$sudo add-apt-repository ppa:jonathonf/python-3.6
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install python3.6
|
|
||||||
```
|
|
||||||
检查已安装的 Python 3.6 版本
|
|
||||||
|
|
||||||
```
|
|
||||||
TerminalShekin@mylinuxmintpc~$python3.6 -V
|
|
||||||
```
|
|
||||||
**请注意**旧版本仍然还在,它仍然可以通过 **python3** 可用,新的版本可以通过命令 **python3.6**。如果你想要使用这个版本而不是 3.5 运行所有的程序,这有个工具叫 **update-alternatives**。但是如果你尝试获取可能的列表,我们会得到错误:
|
|
||||||
[![Python 3.6 - install latest version into Linux Mint](https://mintguide.org/uploads/posts/2017-06/thumbs/1496871711_linux_mint_001.png)][6] 这是正常的,你首先需要为那个问题设置文件,因为维护者并不关心这个:
|
|
||||||
|
|
||||||
```
|
|
||||||
TerminalShekin@mylinuxmintpc~$sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
|
|
||||||
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
|
|
||||||
```
|
|
||||||
现在再次查看:
|
|
||||||
|
|
||||||
```
|
|
||||||
TerminalShekin@mylinuxmintpc~$update-alternatives --list python3
|
|
||||||
```
|
|
||||||
[![Python 3.6 - install latest version into Linux Mint](https://mintguide.org/uploads/posts/2017-06/thumbs/1496871720_linux_mint_002.png)][7] 现在我们选择需要的版本并按需切换。对于设置使用配置命令:
|
|
||||||
|
|
||||||
```
|
|
||||||
TerminalShekin@mylinuxmintpc~$sudo update-alternatives --config python3
|
|
||||||
```
|
|
||||||
[![Python 3.6 - install latest version into Linux Mint](https://mintguide.org/uploads/posts/2017-06/thumbs/1496871722_linux_mint_003.png)][8] 在提示符中,你需要指定默认使用的编号。小心选择一个版本,不要按到 python(python2),只使用 python3,如我所说,Python 2.7 写了不同的系统工具,如果你尝试用错误的解释器版本运行,那么什么都不会发生。愿原力与你同在,好运!!!
|
|
||||||
|
|
||||||
[python.org][9]
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://mintguide.org/other/794-python-3-6-install-latest-version-into-linux-mint.html
|
|
||||||
|
|
||||||
作者:[ Shekin][a]
|
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[a]:https://mintguide.org/user/Shekin/
|
|
||||||
[1]:http://www.codeweavers.com/?ad=708
|
|
||||||
[2]:https://mintguide.org/engine/dude/index/leech_out.php?a%3AaHR0cHM6Ly93d3cucHl0aG9uLm9yZw%3D%3D
|
|
||||||
[3]:https://mintguide.org/
|
|
||||||
[4]:https://mintguide.org/
|
|
||||||
[5]:https://mintguide.org/
|
|
||||||
[6]:https://mintguide.org/uploads/posts/2017-06/1496871711_linux_mint_001.png
|
|
||||||
[7]:https://mintguide.org/uploads/posts/2017-06/1496871720_linux_mint_002.png
|
|
||||||
[8]:https://mintguide.org/uploads/posts/2017-06/1496871722_linux_mint_003.png
|
|
||||||
[9]:https://mintguide.org/engine/dude/index/leech_out.php?a%3AaHR0cHM6Ly93d3cucHl0aG9uLm9yZw%3D%3D
|
|
||||||
[10]:https://mintguide.org/other/
|
|
Loading…
Reference in New Issue
Block a user