阿里云ECS下Ubuntu 16.04系统安装python3.6.5 环境并设置为默认
一、添加python3.6安装包并安装;
二、修改系统默认python版本为3.6;
三、安装并升级pip版本;
一、添加python3.6安装包并安装;
sudo apt-get install software-properties-common -y
二、修改系统默认python版本为3.6;
sudo add-apt-repository ppa:jonathonf/python-3.6 -y
sudo apt-get update -y
sudo apt-get install python3.6 -y
cd /usr/bin/
rm python
ln -s /usr/bin/python3.6m python
三、安装并升级pip版本;
sudo apt install python3-pip -y
pip -v
pip -V
sudo pip install --upgrade pip
pip -V
pip3 -V
[BEGIN] 2018/7/4 20:42:22
[c:\~]$
Connecting to 123.56.2.113:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Welcome to Ubuntu 16.04.4 LTS (GNU/Linux 4.4.0-117-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Welcome to Alibaba Cloud Elastic Compute Service !
root@iZxtw2roczrjdaZ:~# uname -r
4.4.0-117-generic
root@iZxtw2roczrjdaZ:~# uname -a
Linux iZxtw2roczrjdaZ 4.4.0-117-generic #141-Ubuntu SMP Tue Mar 13 11:58:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
root@iZxtw2roczrjdaZ:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"
root@iZxtw2roczrjdaZ:~# sudo apt-get install software-properties-common -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-87 linux-headers-4.4.0-87-generic linux-image-4.4.0-87-generic linux-image-extra-4.4.0-87-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
python3-pycurl python3-software-properties unattended-upgrades
Suggested packages:
libcurl4-gnutls-dev python-pycurl-doc python3-pycurl-dbg bsd-mailx
The following NEW packages will be installed:
python3-pycurl python3-software-properties software-properties-common unattended-upgrades
0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded.
Need to get 104 kB of archives.
After this operation, 799 kB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/ubuntu xenial/main amd64 python3-pycurl amd64 7.43.0-1ubuntu1 [42.3 kB]
Get:2 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 python3-software-properties all 0.96.20.7 [20.3 kB]
Get:3 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 software-properties-common all 0.96.20.7 [9,452 B]
Get:4 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 unattended-upgrades all 0.90ubuntu0.9 [32.3 kB]
Fetched 104 kB in 0s (1,623 kB/s)
Preconfiguring packages ...
Selecting previously unselected package python3-pycurl.
(Reading database ... 132834 files and directories currently installed.)
Preparing to unpack .../python3-pycurl_7.43.0-1ubuntu1_amd64.deb ...
Unpacking python3-pycurl (7.43.0-1ubuntu1) ...
Selecting previously unselected package python3-software-properties.
Preparing to unpack .../python3-software-properties_0.96.20.7_all.deb ...
Unpacking python3-software-properties (0.96.20.7) ...
Selecting previously unselected package software-properties-common.
Preparing to unpack .../software-properties-common_0.96.20.7_all.deb ...
Unpacking software-properties-common (0.96.20.7) ...
Selecting previously unselected package unattended-upgrades.
Preparing to unpack .../unattended-upgrades_0.90ubuntu0.9_all.deb ...
Unpacking unattended-upgrades (0.90ubuntu0.9) ...
Processing triggers for dbus (1.10.6-1ubuntu3.3) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up python3-pycurl (7.43.0-1ubuntu1) ...
Setting up python3-software-properties (0.96.20.7) ...
Setting up software-properties-common (0.96.20.7) ...
Setting up unattended-upgrades (0.90ubuntu0.9) ... Creating config file /etc/apt/apt.conf.d/50unattended-upgrades with new version
insserv: can not symlink(../init.d/aegis, ../rc2.d/S02aegis): File exists
insserv: can not symlink(../init.d/aegis, ../rc3.d/S02aegis): File exists
insserv: can not symlink(../init.d/aegis, ../rc4.d/S02aegis): File exists
insserv: can not symlink(../init.d/aegis, ../rc5.d/S02aegis): File exists
Synchronizing state of unattended-upgrades.service with SysV init with /lib/systemd/systemd-sysv-install...
Executing /lib/systemd/systemd-sysv-install enable unattended-upgrades
Processing triggers for dbus (1.10.6-1ubuntu3.3) ...
Processing triggers for systemd (229-4ubuntu21.2) ...
Processing triggers for ureadahead (0.100.0-19) ...
root@iZxtw2roczrjdaZ:~# sudo add-apt-repository ppa:jonathonf/python-3.6 -y
gpg: keyring `/tmp/tmp1cj4_vjv/secring.gpg' created
gpg: keyring `/tmp/tmp1cj4_vjv/pubring.gpg' created
gpg: requesting key F06FC659 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp1cj4_vjv/trustdb.gpg: trustdb created
gpg: key F06FC659: public key "Launchpad PPA for J Fernyhough" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
root@iZxtw2roczrjdaZ:~# sudo apt-get update -y
Hit:1 http://mirrors.aliyun.com/ubuntu xenial InRelease
Get:2 http://mirrors.aliyun.com/ubuntu xenial-updates InRelease [109 kB]
Get:3 http://mirrors.aliyun.com/ubuntu xenial-security InRelease [107 kB]
Get:4 http://mirrors.aliyun.com/ubuntu xenial-updates/main Sources [311 kB]
Get:5 http://mirrors.aliyun.com/ubuntu xenial-updates/universe Sources [205 kB]
Get:6 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 Packages [803 kB]
Get:7 http://mirrors.aliyun.com/ubuntu xenial-updates/main i386 Packages [732 kB]
Get:8 http://mirrors.aliyun.com/ubuntu xenial-updates/main Translation-en [331 kB]
Get:9 http://mirrors.aliyun.com/ubuntu xenial-updates/universe amd64 Packages [640 kB]
Get:10 http://mirrors.aliyun.com/ubuntu xenial-updates/universe i386 Packages [584 kB]
Get:11 http://mirrors.aliyun.com/ubuntu xenial-updates/universe Translation-en [258 kB]
Get:12 http://mirrors.aliyun.com/ubuntu xenial-security/main Sources [126 kB]
Get:13 http://mirrors.aliyun.com/ubuntu xenial-security/universe Sources [66.0 kB]
Get:14 http://mirrors.aliyun.com/ubuntu xenial-security/main amd64 Packages [518 kB]
Get:15 http://mirrors.aliyun.com/ubuntu xenial-security/main i386 Packages [456 kB]
Get:16 http://mirrors.aliyun.com/ubuntu xenial-security/main Translation-en [222 kB]
Get:17 http://mirrors.aliyun.com/ubuntu xenial-security/universe amd64 Packages [356 kB]
Get:18 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial InRelease [18.0 kB]
Get:19 http://mirrors.aliyun.com/ubuntu xenial-security/universe i386 Packages [304 kB]
Get:20 http://mirrors.aliyun.com/ubuntu xenial-security/universe Translation-en [133 kB]
Get:21 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 Packages [4,760 B]
Get:22 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main i386 Packages [4,748 B]
Get:23 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main Translation-en [2,128 B]
Fetched 6,292 kB in 3s (1,707 kB/s)
Reading package lists... Done
root@iZxtw2roczrjdaZ:~# sudo apt-get install python3.6 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-87 linux-headers-4.4.0-87-generic linux-image-4.4.0-87-generic linux-image-extra-4.4.0-87-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libpython3.6-minimal libpython3.6-stdlib python3.6-minimal
Suggested packages:
python3.6-venv python3.6-doc binfmt-support
The following NEW packages will be installed:
libpython3.6-minimal libpython3.6-stdlib python3.6 python3.6-minimal
0 upgraded, 4 newly installed, 0 to remove and 62 not upgraded.
Need to get 4,505 kB of archives.
After this operation, 23.1 MB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 libpython3.6-minimal amd64 3.6.5-5~16.04.york1 [574 kB]
Get:2 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 python3.6-minimal amd64 3.6.5-5~16.04.york1 [1,712 kB]
Get:3 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 libpython3.6-stdlib amd64 3.6.5-5~16.04.york1 [1,989 kB]
Get:4 http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu xenial/main amd64 python3.6 amd64 3.6.5-5~16.04.york1 [230 kB]
Fetched 4,505 kB in 57s (77.9 kB/s)
Selecting previously unselected package libpython3.6-minimal:amd64.
(Reading database ... 132892 files and directories currently installed.)
Preparing to unpack .../libpython3.6-minimal_3.6.5-5~16.04.york1_amd64.deb ...
Unpacking libpython3.6-minimal:amd64 (3.6.5-5~16.04.york1) ...
Selecting previously unselected package python3.6-minimal.
Preparing to unpack .../python3.6-minimal_3.6.5-5~16.04.york1_amd64.deb ...
Unpacking python3.6-minimal (3.6.5-5~16.04.york1) ...
Selecting previously unselected package libpython3.6-stdlib:amd64.
Preparing to unpack .../libpython3.6-stdlib_3.6.5-5~16.04.york1_amd64.deb ...
Unpacking libpython3.6-stdlib:amd64 (3.6.5-5~16.04.york1) ...
Selecting previously unselected package python3.6.
Preparing to unpack .../python3.6_3.6.5-5~16.04.york1_amd64.deb ...
Unpacking python3.6 (3.6.5-5~16.04.york1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up libpython3.6-minimal:amd64 (3.6.5-5~16.04.york1) ...
Setting up python3.6-minimal (3.6.5-5~16.04.york1) ...
Setting up libpython3.6-stdlib:amd64 (3.6.5-5~16.04.york1) ...
Setting up python3.6 (3.6.5-5~16.04.york1) ...
root@iZxtw2roczrjdaZ:~# cd /usr/bin/
root@iZxtw2roczrjdaZ:/usr/bin# rm python
root@iZxtw2roczrjdaZ:/usr/bin# ln -s /usr/bin/python3.6m python
root@iZxtw2roczrjdaZ:/usr/bin# python
Python 3.6.5 (default, May 3 2018, 10:08:28)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
root@iZxtw2roczrjdaZ:/usr/bin# python2
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
root@iZxtw2roczrjdaZ:/usr/bin# sudo apt install python3-pip -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-87 linux-headers-4.4.0-87-generic linux-image-4.4.0-87-generic linux-image-extra-4.4.0-87-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libpython3-dev libpython3.5-dev python3-dev python3-setuptools python3-wheel python3.5-dev
Suggested packages:
python-setuptools-doc
The following NEW packages will be installed:
libpython3-dev libpython3.5-dev python3-dev python3-pip python3-setuptools python3-wheel python3.5-dev
0 upgraded, 7 newly installed, 0 to remove and 62 not upgraded.
Need to get 38.0 MB of archives.
After this operation, 55.2 MB of additional disk space will be used.
Get:1 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 libpython3.5-dev amd64 3.5.2-2ubuntu0~16.04.4 [37.3 MB]
Get:2 http://mirrors.aliyun.com/ubuntu xenial/main amd64 libpython3-dev amd64 3.5.1-3 [6,926 B]
Get:3 http://mirrors.aliyun.com/ubuntu xenial-updates/main amd64 python3.5-dev amd64 3.5.2-2ubuntu0~16.04.4 [413 kB]
Get:4 http://mirrors.aliyun.com/ubuntu xenial/main amd64 python3-dev amd64 3.5.1-3 [1,186 B]
Get:5 http://mirrors.aliyun.com/ubuntu xenial-updates/universe amd64 python3-pip all 8.1.1-2ubuntu0.4 [109 kB]
Get:6 http://mirrors.aliyun.com/ubuntu xenial/main amd64 python3-setuptools all 20.7.0-1 [88.0 kB]
Get:7 http://mirrors.aliyun.com/ubuntu xenial/universe amd64 python3-wheel all 0.29.0-1 [48.1 kB]
Fetched 38.0 MB in 2s (16.0 MB/s) Selecting previously unselected package libpython3.5-dev:amd64.
(Reading database ... 133645 files and directories currently installed.)
Preparing to unpack .../libpython3.5-dev_3.5.2-2ubuntu0~16.04.4_amd64.deb ...
Unpacking libpython3.5-dev:amd64 (3.5.2-2ubuntu0~16.04.4) ...
Selecting previously unselected package libpython3-dev:amd64.
Preparing to unpack .../libpython3-dev_3.5.1-3_amd64.deb ...
Unpacking libpython3-dev:amd64 (3.5.1-3) ...
Selecting previously unselected package python3.5-dev.
Preparing to unpack .../python3.5-dev_3.5.2-2ubuntu0~16.04.4_amd64.deb ...
Unpacking python3.5-dev (3.5.2-2ubuntu0~16.04.4) ...
Selecting previously unselected package python3-dev.
Preparing to unpack .../python3-dev_3.5.1-3_amd64.deb ...
Unpacking python3-dev (3.5.1-3) ...
Selecting previously unselected package python3-pip.
Preparing to unpack .../python3-pip_8.1.1-2ubuntu0.4_all.deb ...
Unpacking python3-pip (8.1.1-2ubuntu0.4) ...
Selecting previously unselected package python3-setuptools.
Preparing to unpack .../python3-setuptools_20.7.0-1_all.deb ...
Unpacking python3-setuptools (20.7.0-1) ...
Selecting previously unselected package python3-wheel.
Preparing to unpack .../python3-wheel_0.29.0-1_all.deb ...
Unpacking python3-wheel (0.29.0-1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libpython3.5-dev:amd64 (3.5.2-2ubuntu0~16.04.4) ...
Setting up libpython3-dev:amd64 (3.5.1-3) ...
Setting up python3.5-dev (3.5.2-2ubuntu0~16.04.4) ...
Setting up python3-dev (3.5.1-3) ...
Setting up python3-pip (8.1.1-2ubuntu0.4) ...
Setting up python3-setuptools (20.7.0-1) ...
Setting up python3-wheel (0.29.0-1) ... root@iZxtw2roczrjdaZ:/usr/bin# pip -v Usage:
pip <command> [options] Commands:
install Install packages.
download Download packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
hash Compute hashes of package archives.
completion A helper command used for command completion
help Show help for commands. General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output.
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
--trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.
root@iZxtw2roczrjdaZ:/usr/bin# pip -V
pip 8.1.1 from /usr/lib/python3/dist-packages (python 3.6)
root@iZxtw2roczrjdaZ:/usr/bin# sudo pip install --upgrade pip
Collecting pip
Downloading http://mirrors.aliyun.com/pypi/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 41.9MB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
Successfully installed pip-10.0.1
root@iZxtw2roczrjdaZ:/usr/bin# pip -V
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name 'main'
root@iZxtw2roczrjdaZ:/usr/bin# pip3 -V
pip 10.0.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
阿里云ECS下Ubuntu 16.04系统安装python3.6.5 环境并设置为默认的更多相关文章
- 阿里云ECS下CentOS7.4 yum安装Python3.6环境
一.安装EPEL和IUS软件源 二.安装Python3.6 三.创建python3软链接连接符 四.安装pip3 五.创建pip3链接符 六.进行验证是否安装成功 一.安装EPEL和IUS软件源 yu ...
- 阿里云ECS下基于Centos7.4安装MySQL5.7.20
1.首先登录阿里云ECS服务器,如下图所示: 2.卸载MariaDB 说明:CentOS7.x默认安装MariaDB而不是MySQL,而且yum服务器上也移除了MySQL相关的软件包.因为Maria ...
- 在Ubuntu 16.04 安装python3.6 环境并设置为默认
在Ubuntu 16.04 安装python3.6 环境并设置为默认 1.添加python3.6安装包,并且安装 sudo apt-get install software-properties-co ...
- 解决阿里云ECS下kubeadm部署k8s无法指定公网IP
背景 一般情况下,"kubeadm"部署集群时指定"--apiserver-advertise-address=<public_ip>"参数,即可在 ...
- 阿里云ECS服务器配置ubuntu安装openfire服务器
最近搞了一台阿里云的ECS服务器,因为搞活动半年免费,所以就申请了一台,过两天就批准下来,顺便多花了1百多RMB买了固定IP.总体说来还是挺值的,觉得一个人用挺浪费,分享出来跟大家一起玩玩. 搞台服务 ...
- Ubuntu 16.04 安装 Python3.6
直接在官网下载 Python3.6.3 的源代码,解压缩,按照 README.rst 内说明步骤编译安装即可,这样 pip3.6 也会自动安装. 注意第一步配置时最好指定安装目录, $ ./confi ...
- Ubuntu 16.04安装JDK并配置环境变量-【小白版】
系统版本:Ubuntu 16.04 JDK版本:jdk1.8.0_121 1.官网下载JDK文件jdk-8u121-linux-x64.tar.gz 我这里下的是最新版,其他版本也可以 2.创建一个目 ...
- Ubuntu 16.04使用python3.x相关
下载pip3 Python 3.x版本使用pip3,它会把你想下载的包放到usr/local/lib/python3.5/dist-packages/下,而非usr/local/lib/python2 ...
- Ubuntu 16.04安装JDK并配置环境变量(转发:https://blog.csdn.net/yan3013216087/article/details/78307258)
系统版本:Ubuntu 16.04 JDK版本:jdk1.8.0_121 1.官网下载JDK文件jdk-8u121-linux-x64.tar.gz 我这里下的是最新版,其他版本也可以 2.创建一个目 ...
随机推荐
- SpringMVC关于请求参数乱码问题
String names =request.getParameter("name") request主要接收的参数是form提交 form提交有的时候会伴随着乱码,该乱码的格式为I ...
- [转]JOGL安装
本章介绍了设置环境以使用JOGL使用不同的集成开发环境(IDE),在您的系统上. 安装JOGL 对于JOGL安装,需要有以下系统要求: 系统要求 第一个要求是要在机器上安装Java Developme ...
- byte转换字符串(string)+字符串转换byte
C# 中字符串string和字节数组byte[]的转换 //string转byte[]: byte[] byteArray = System.Text.Encoding.Default.GetByte ...
- x+=i和x = x+i比较 -- 简单赋值和复合赋值
这两个赋值方式其实是有区别的,如果最后结果的类型和左操作数的类型一样,那么这两个表达式就完全等价. 下面来看看两个例子来理解它们的区别: 编写一个程序,使得x+=i合法, x = x+i: 不合法. ...
- Gradle Goodness: Check Task Dependencies With a Dry Run
We can run a Gradle build without any of the task actions being executed. This is a so-called dry ru ...
- idea中查看类层级class hierarchy
idea中,我当前设置的是eclipse的快捷键(从eclipse转过来的) 一般情况下,查看类的子类Ctrl+T 如何以树的形式查看完整继承关系,快捷键:F4 效果如下: 尤其从根节点查看的时候,完 ...
- hadoop-1.2.1运行过程中遇到的问题
在hadoop-1.2.1中运行所遇到的问题: 2014-11-14 22:43:42 在服务器上运行hadoop-1.2.1中的datanode,出现了内存占用过大,导致ssh登陆出现如下问题 ...
- mysql获取正在运行的sql
select id,db,host,time,info,command from information_schema.processlist where command<>'sleep' ...
- oracle查询相关注意点
单表查询: .or 和 and 混合使用 需求:查询业主名称包含'刘'或门牌号包含'5'的,并且地址编号为3的记录 and 的权限优先于 or 所以需要在or的两边添加() 2. 范围查询 除了传统的 ...
- chromium之message_pump_win之一
写了22篇博文,终于到这里了———— MessagePumpWin!!! MessagePumpWin这个类还是挺复杂的,可以分成好几部分.接下来分块分析 从介绍看,MessagePumpWin 是M ...