一、添加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 环境并设置为默认的更多相关文章

  1. 阿里云ECS下CentOS7.4 yum安装Python3.6环境

    一.安装EPEL和IUS软件源 二.安装Python3.6 三.创建python3软链接连接符 四.安装pip3 五.创建pip3链接符 六.进行验证是否安装成功 一.安装EPEL和IUS软件源 yu ...

  2. 阿里云ECS下基于Centos7.4安装MySQL5.7.20

     1.首先登录阿里云ECS服务器,如下图所示: 2.卸载MariaDB 说明:CentOS7.x默认安装MariaDB而不是MySQL,而且yum服务器上也移除了MySQL相关的软件包.因为Maria ...

  3. 在Ubuntu 16.04 安装python3.6 环境并设置为默认

    在Ubuntu 16.04 安装python3.6 环境并设置为默认 1.添加python3.6安装包,并且安装 sudo apt-get install software-properties-co ...

  4. 解决阿里云ECS下kubeadm部署k8s无法指定公网IP

    背景 一般情况下,"kubeadm"部署集群时指定"--apiserver-advertise-address=<public_ip>"参数,即可在 ...

  5. 阿里云ECS服务器配置ubuntu安装openfire服务器

    最近搞了一台阿里云的ECS服务器,因为搞活动半年免费,所以就申请了一台,过两天就批准下来,顺便多花了1百多RMB买了固定IP.总体说来还是挺值的,觉得一个人用挺浪费,分享出来跟大家一起玩玩. 搞台服务 ...

  6. Ubuntu 16.04 安装 Python3.6

    直接在官网下载 Python3.6.3 的源代码,解压缩,按照 README.rst 内说明步骤编译安装即可,这样 pip3.6 也会自动安装. 注意第一步配置时最好指定安装目录, $ ./confi ...

  7. Ubuntu 16.04安装JDK并配置环境变量-【小白版】

    系统版本:Ubuntu 16.04 JDK版本:jdk1.8.0_121 1.官网下载JDK文件jdk-8u121-linux-x64.tar.gz 我这里下的是最新版,其他版本也可以 2.创建一个目 ...

  8. Ubuntu 16.04使用python3.x相关

    下载pip3 Python 3.x版本使用pip3,它会把你想下载的包放到usr/local/lib/python3.5/dist-packages/下,而非usr/local/lib/python2 ...

  9. 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.创建一个目 ...

随机推荐

  1. ServletRequest的四个主要方法

    package com.yunqing.servlet; import javax.servlet.*; import java.io.IOException; import java.util.Ar ...

  2. HDU 1789 Doing Homework again(非常经典的贪心)

    Doing Homework again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Oth ...

  3. 课时8.HTML作用(掌握)

    什么是HTML? HTML其实是HyperText Markup Language的缩写,超文本标记语言 如何重命名文件? 点击右键重命名 点击F2 首先利用记事本保存了一个标题和两段描述,然后修改纯 ...

  4. Spring boot 的profile功能如何实现多环境配置自动切换

    通常服务端应用开发需要经过以下几个流程: 开发 -> 测试 -> RC验证 -> 上线 这就涉及到四个不同的环境,开发环境.测试环境.RC环境以及生产环境,为了避免不同环境之间相互干 ...

  5. mysql导出数据很快,导入很慢

    mysql导出快,导入特别慢的解决方法:在导入时添加两个参数:max_allowed_packet; net_buffer_length --max_allowed_packet   客户端/服务器之 ...

  6. IOS 文件名获取简洁方式

    //这里有一个模拟器沙盒路径(完整路径) NSString* index=@"/Users/junzoo/Library/Application Support/iPhone Simulat ...

  7. About Me - 关于

    0x00 简介 97年生 计算机相关专业,无线电安全攻防方向. 涉猎较多,喜欢研究无线.硬件.软件.网络.攻击.检测.防御等各类安全技术 精通较少,主要擅长的还是硬件.渗透.无线攻击方面. 现阶段在研 ...

  8. 20181030NOIP模拟赛T2

    WYT的刷子 WYT有一把巨大的刷子,刷子的宽度为M米,现在WYT要使用这把大刷子去粉刷有N列的栅栏(每列宽度都为1米:每列的高度单位也为米,由输入数据给出). 使用刷子的规则是: 1.与地面垂直,从 ...

  9. linux系统的介绍与环境搭建准备38-40

    操作系统(OS):用于控制管理计算机,形成在用户和机器之间传递信息的系统软件 linux是什么? <--unix系统是linux的前身---> 特点: 开放的源代码,自由修改 自由传播,没 ...

  10. 路由(二) router-link的使用

    main.js import Vue from 'vue'import App from './App'import VueRouter from 'vue-router'import footer ...