上如何安装并切换最新版本的 Python 3.6 Linux 上如何安装并切换最新版本的 Python 3.6

Linux \u4e0a\u5982\u4f55\u5b89\u88c5\u5e76\u5207\u6362\u6700\u65b0\u7248\u672c\u7684 Python 3.6

Python \u662f Linux \u4e2d\u4e00\u79cd\u6700\u6d41\u884c\u7684\u7f16\u7a0b\u8bed\u8a00\u3002\u5b83\u88ab\u5199\u6210\u4e86\u5404\u79cd\u5de5\u5177\u548c\u5e93\u3002\u9664\u6b64\u4e4b\u5916\uff0cPython \u5728\u5f00\u53d1\u8005\u4e4b\u95f4\u5f88\u6d41\u884c\u56e0\u4e3a\u5b83\u975e\u5e38\u7b80\u5355\uff0c\u5e76\u4e14\u5b9e\u9645\u5f88\u5bb9\u6613\u638c\u63e1\u3002\u5982\u679c\u4f60\u5b89\u88c5\u4e86 Linux \u7cfb\u7edf\uff0c\u6b63\u5728\u5b66\u4e60 Python \u5e76\u60f3\u8981\u4f7f\u7528\u6700\u65b0\u7684\u7248\u672c\u7684\u8bdd\uff0c\u90a3\u4e48\u8fd9\u7bc7\u6587\u7ae0\u5c31\u662f\u4e3a\u4f60\u800c\u5199\u7684\u3002\u73b0\u5728\u6211\u5df2\u7ecf\u5b89\u88c5\u597d\u4e86 Linux Mint 18\u3002\u9ed8\u8ba4\u5b89\u88c5\u7684\u7248\u672c\u662f 2.7 \u548c 3.5\u3002\u4f60\u53ef\u4ee5\u7528\u8fd9\u4e2a\u547d\u4ee4\u68c0\u67e5\uff1a
$ python -V
$ python2 -V
$ python3 -V
\u5b89\u88c5\u6700\u65b0\u7684 Python 3.6 \u5230 Linux \u4e2d\uff1a
$ sudo add-apt-repository ppa:jonathonf/python-3.6
$ sudo apt update
$ sudo apt install python3.6
\u68c0\u67e5\u5df2\u5b89\u88c5\u7684 Python 3.6 \u7248\u672c
$ python3.6-V
\u8bf7\u6ce8\u610f\u65e7\u7248\u672c\u4ecd\u7136\u8fd8\u5728\uff0c\u5b83\u4ecd\u7136\u53ef\u4ee5\u901a\u8fc7 python3 \u53ef\u7528\uff0c\u65b0\u7684\u7248\u672c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4 python3.6\u3002\u5982\u679c\u4f60\u60f3\u8981\u9ed8\u8ba4\u4f7f\u7528\u8fd9\u4e2a\u7248\u672c\u800c\u4e0d\u662f 3.5 \u8fd0\u884c\u6240\u6709\u7684\u7a0b\u5e8f\uff0c\u8fd9\u6709\u4e2a\u5de5\u5177\u53eb update-alternatives\u3002\u4f46\u662f\u5982\u679c\u4f60\u5c1d\u8bd5\u83b7\u53d6\u53ef\u80fd\u7684\u5217\u8868\uff0c\u6211\u4eec\u4f1a\u5f97\u5230\u9519\u8bef\uff1a

Python 3.6 - install latest version into Linux Mint
\u8fd9\u662f\u6b63\u5e38\u7684\uff0c\u4f60\u9996\u5148\u9700\u8981\u4e3a\u90a3\u4e2a\u95ee\u9898\u8bbe\u7f6e\u6587\u4ef6\uff0c\u56e0\u4e3a\u7ef4\u62a4\u8005\u6ca1\u6709\u8bbe\u7f6e\u8fd9\u4e2a\uff1a
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.51
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.62
\u73b0\u5728\u518d\u6b21\u67e5\u770b\uff1a
$ update-alternatives --list python3

Python 3.6 - install latest version into Linux Mint
\u73b0\u5728\u6211\u4eec\u9009\u62e9\u9700\u8981\u7684\u7248\u672c\u5e76\u6309\u9700\u5207\u6362\u3002\u5bf9\u4e8e\u8bbe\u7f6e\u4f7f\u7528\u914d\u7f6e\u547d\u4ee4\uff1a
$ sudo update-alternatives --config python3

Python 3.6 - install latest version into Linux Mint
\u5728\u63d0\u793a\u7b26\u4e2d\uff0c\u4f60\u9700\u8981\u6307\u5b9a\u9ed8\u8ba4\u4f7f\u7528\u7684\u7f16\u53f7\u3002
\u9009\u62e9\u7248\u672c\u65f6\u8981\u5c0f\u5fc3\uff0c\u4e0d\u8981\u53bb\u52a8 python\uff08python2\uff09\uff0c\u53ea\u4f7f\u7528\u6211\u8bf4\u7684 python3\uff0cPython 2.7 \u7f16\u5199\u4e86\u5404\u79cd\u7cfb\u7edf\u5de5\u5177\uff0c\u5982\u679c\u4f60\u5c1d\u8bd5\u7528\u9519\u8bef\u7684\u89e3\u91ca\u5668\u7248\u672c\u8fd0\u884c\u5b83\u4eec\uff0c\u53ef\u80fd\u5c31\u4e0d\u4f1a\u5de5\u4f5c\u3002

\u5728CentOS7\u4e2d\u5b89\u88c5Python\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd\u7cfb\u7edf\u4e2d\u5df2\u7ecf\u6709\u4e86\u6240\u6709\u5fc5\u8981\u7684\u5f00\u53d1\u4f9d\u8d56\uff1a#yum-ygroupinstalldevelopment#yum-yinstallzlib-devel\u5728Debian\u4e2d\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5gcc\u3001make\u548czlib\u538b\u7f29/\u89e3\u538b\u7f29\u5e93\uff1a#aptitude-yinstallgccmakezlib1g-dev\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u6765\u5b89\u88c5Python3.6\uff1a#wgetconfigure#make&&makeinstall\u73b0\u5728\uff0c\u653e\u677e\u4e00\u4e0b\uff0c\u6216\u8005\u997f\u7684\u8bdd\u53bb\u5403\u4e2a\u4e09\u660e\u6cbb\uff0c\u56e0\u4e3a\u8fd9\u53ef\u80fd\u9700\u8981\u82b1\u8d39\u4e00\u4e9b\u65f6\u95f4\u3002\u5b89\u88c5\u5b8c\u6210\u4ee5\u540e\uff0c\u4f7f\u7528which\u547d\u4ee4\u6765\u67e5\u770b\u4e3b\u8981\u4e8c\u8fdb\u5236\u4ee3\u7801\u7684\u4f4d\u7f6e\uff1a#python3-V

一、下载

  1. 百度 Python官网下载 ,核对横线处网址是否正确,一致即可点击进去了。


2.进入官网后,点击 Downloads - Windows-版本号Python 3.6.3 或者 经典版Python 2.7.14。即可弹出下载框下载了。默认32位的软件(64位系统也可以正常使用)。本文Python 3.6.3默认下载。

3.需要其他版本,点击 View the full list of downloads  ,就可以看到所有版本了,选择自己需要的版本就好。其中x86 是32位,x64 是64位软件。

二、安装

  1. 点击 Customize installation  并选中  Add Python 3.6 to PATH (后面有用)

  2. 点击 Next  (下一步)。

  3. 点击 Browse  (浏览),选择安装目录,本文安装在C盘根目录。可以直接输入路径。然后点击Install.

  4. 等待片刻,就会提示 Setup was successful ( 安装成功 ),点击 Close (关闭)。这样就安装成功了。

三、安装后的系统设置-系统变量PATH

  1. 在桌面或者star(开始)菜单的此电脑或者我的电脑或我的计算机,右键点击 属性 (system Properties) 弹出对话框;

  2. 点击高级系统设置;

  3. 切换 高级(advanced)标签,点击 环境变量  -确定

  4. 在 系统变量 处,点击 新建  ,输入名称和路径 c:\Python ,便于调用 python.exe .安装其他路径的自行按照实际位置修改,如下图2中1的路径,可以直接复制粘贴。

  5. 同样方法创建 系统变量,输入名称和路径  c:\Python\Scripts ,便于调用第三方脚本。



扩展阅读:设置安装 ... 三种模式怎么切换 ... 手机底部三个按键怎么设置 ... 华为纯净模式不让安装 ... 最新版电子税务局界面 ... 华为蛋仔切换不了账号 ... 安卓手机怎么切换地区 ... 手机5g网络设置方法 ... 设置下载安装桌面 ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网