Ubuntu16.04上将系统自带的python3.5升级到3.6

安装aioredis时提示Python版本需>=3.5.3,所以进行升级
命令如下:

$ sudo add-apt-repository ppa:jonathonf/python-3.6
$ sudo apt-get update
$ sudo apt-get install python3.*

注意,安装python3.6的时候一定要加*,将3.6所需的依赖库也一起装上

注意,python3.5不要卸载,卸载会损坏系统。

# 移除原3.4link
$ sudo rm /usr/bin/python3 # 更换默认python3 的版本为3.
$ sudo ln -s /usr/bin/python3. /usr/bin/python3

安装完Python后pip需重新安装:

$ wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
$ sudo python get-pip.py

问题解决

参考:https://askubuntu.com/questions/1037528/apt-get-upgrade-error-for-python-packages-in-ubuntu-16-04

在ubuntu上将python3.5升级到python3.6,执行如下命令时,遇到错误:

sudo apt-get install python3.*
Building dependency tree
Reading state information... Done
Note, selecting 'python3.6-2to3' for glob 'python3.6*'
Note, selecting 'python3.6-venv' for glob 'python3.6*'
Note, selecting 'python3.6-examples' for glob 'python3.6*'
Note, selecting 'python3.6' for glob 'python3.6*'
Note, selecting 'python3.6-tk' for glob 'python3.6*'
Note, selecting 'python3.6-lib2to3' for glob 'python3.6*'
Note, selecting 'python3.6-minimal' for glob 'python3.6*'
Note, selecting 'python3.6-gdbm' for glob 'python3.6*'
Note, selecting 'python3.6-dbg' for glob 'python3.6*'
Note, selecting 'python3.6-dev' for glob 'python3.6*'
Note, selecting 'python3.6-doc' for glob 'python3.6*'
Note, selecting 'python3.6-distutils' for glob 'python3.6*'
Note, selecting 'python3-tk' instead of 'python3.6-tk'
Note, selecting 'python3-distutils' instead of 'python3.6-distutils'
Note, selecting 'python3-gdbm' instead of 'python3.6-gdbm'
Note, selecting 'python3-lib2to3' instead of 'python3.6-lib2to3'
python3-gdbm is already the newest version (3.6.5-3~16.04.york4).
python3-tk is already the newest version (3.6.5-3~16.04.york4).
python3.6 is already the newest version (3.6.8-1~16.04.york1).
python3.6-dbg is already the newest version (3.6.8-1~16.04.york1).
python3.6-dev is already the newest version (3.6.8-1~16.04.york1).
python3.6-doc is already the newest version (3.6.8-1~16.04.york1).
python3.6-examples is already the newest version (3.6.8-1~16.04.york1).
python3.6-minimal is already the newest version (3.6.8-1~16.04.york1).
python3.6-venv is already the newest version (3.6.8-1~16.04.york1).
The following NEW packages will be installed:
python3-distutils python3-lib2to3
0 upgraded, 2 newly installed, 0 to remove and 261 not upgraded.
Need to get 0 B/219 kB of archives.
After this operation, 1,090 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 292643 files and directories currently installed.)
Preparing to unpack .../python3-lib2to3_3.6.5-3~16.04.york0.2_all.deb ...
Unpacking python3-lib2to3 (3.6.5-3~16.04.york0.2) ...
dpkg: error processing archive /var/cache/apt/archives/python3-lib2to3_3.6.5-3~16.04.york0.2_all.deb (--unpack):
trying to overwrite '/usr/lib/python3.6/lib2to3/Grammar.txt', which is also in package libpython3.6-stdlib:amd64 3.6.8-1~16.04.york1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../python3-distutils_3.6.5-3~16.04.york0.2_all.deb ...
Unpacking python3-distutils (3.6.5-3~16.04.york0.2) ...
dpkg: error processing archive /var/cache/apt/archives/python3-distutils_3.6.5-3~16.04.york0.2_all.deb (--unpack):
trying to overwrite '/usr/lib/python3.6/distutils/dir_util.py', which is also in package libpython3.6-stdlib:amd64 3.6.8-1~16.04.york1
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/python3-lib2to3_3.6.5-3~16.04.york0.2_all.deb
/var/cache/apt/archives/python3-distutils_3.6.5-3~16.04.york0.2_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

对于这种错误,我采取的处理方法是手动强行安装两个安装失败的包(黄底色红字部分):

sudo dpkg --install --force all /var/cache/apt/archives/python3-lib2to3_3.6.5-~16.04.york0.2_all.deb
sudo dpkg --install --force all /var/cache/apt/archives/python3-distutils_3.6.5-~16.04.york0.2_all.deb

然后再执行

sudo apt install -f

然后安装就没问题了

sudo apt-get install python3.*

安装成功!

【Ubuntu升级python3.5到python3.6】dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Errors were encountered while processing: E: Sub-process /usr/bin/dpkg returned an error code (1) 问题解决的更多相关文章

  1. E: Sub-process /usr/bin/dpkg returned an error code (1)

    E: Sub-process /usr/bin/dpkg returned an error code (1) 错误描述 dpkg: error processing archive /var/cac ...

  2. [转]ubuntu错误解决E: Sub-process /usr/bin/dpkg returned an error code (1)

    [转]ubuntu错误解决E: Sub-process /usr/bin/dpkg returned an error code (1) http://yanue.net/post-123.html ...

  3. E: Sub-process /usr/bin/dpkg returned an error code (1)错误解决

    在用apt-get安装软件时出现了类似于install-info: No dir file specified; try --help for more information.dpkg:处理 get ...

  4. E: Sub-process /usr/bin/dpkg returned an error code

    E: Sub-process /usr/bin/dpkg returned an error code (1)错误解决 在用apt-get安装软件时出现了类似于install-info: No dir ...

  5. ubuntu/debian安装mysql遇到的问题及解决方法_1.dpkg中mysql-server-5.5 (configure)时出错 mysql-server-5.5 E: Sub-process /usr/bin/dpkg returned an error code (1)

    我的debian7之前安装了mysql-server,是通过apt安装的,后来我卸载掉, 然后用whereis mysql查找, 把所有关于mysql的目录删除掉,包括带mysqld的目录及文件. 重 ...

  6. Sub-process /usr/bin/dpkg returned an error code (1)解决方法

    在ubuntu下使用apt-get install 安装资源的时候,总是会遇到Sub-process /usr/bin/dpkg returned an error code (1) 错了, 跟安装软 ...

  7. ubuntu 下出现E: Sub-process /usr/bin/dpkg returned an error code

    在用apt-get安装软件时出现了类似于 install-info: No dir file specified; try –help for more information.dpkg:处理 get ...

  8. 【转】E: Sub-process /usr/bin/dpkg returned an error code (1)

    原链接: jaryWang:E: Sub-process /usr/bin/dpkg returned an error code (1)错误解决 1.$ sudo mv /var/lib/dpkg/ ...

  9. 解决Ubuntu sudo apt-get install遇到的E: Sub-process /usr/bin/dpkg returned an error code (1)问题

    如题,本人在安装samba等软件的时候,在命令行敲入: sudo apt-get install samba4命令的时候,系统在下载之后报错,大致内容如下: ~$ sudo apt-get insta ...

随机推荐

  1. java 的任意进制间转换

    直接上代码: public class Main { public static void main(String[] args) { // TODO Auto-generated method st ...

  2. python代码规范 自动优化工具Black

    自动优化工具Black 在众多代码格式化工具中,Black算是比较新的一个,它***的特点是可配置项比较少,个人认为这对于新手来说是件好事,因为我们不必过多考虑如何设置Black,让 Black 自己 ...

  3. qt事件机制(转)

    学习了一段时间的Qt之后,发现Qt的事件机制和其他语言的机制有些不同.Qt除了能够通过信号和槽机制来实现一些Action动作之外,还可以用对象所带的事件,或者用户自定义的事件来实现对象的一些行为处理. ...

  4. 通过Python实现mysql查询数据库实例

    #coding:utf-8 ''' Created on 2017年10月25日 @author: li.liu ''' import pymysql db=pymysql.connect('loca ...

  5. ThinkPHP远程调用模块的操作方法 URL 参数格式

    * 远程调用模块的操作方法 URL 参数格式 [项目://][分组/]模块/操作 * @param string $url 调用地址 * @param string|array $vars 调用参数 ...

  6. pandas 6 时间

    类 备注 创建方法 Timestamp 时刻数据 to_datetime,Timestamp DatetimeIndex Timestamp的索引 to_datetime,date_range,Dat ...

  7. JavaScript基础04——数组的创建及方法

    数组的概念及定义 数组的概念:         一组数据,数据的组和         哪些数据的组和,只要是数据(所有数据),就可以放在数组中 数组的意义:         可以同时操作多个数据 数组 ...

  8. 关于new FormData() 对象的用法

    formData.append()  理论上本身若键值已经存在,那么我们append的数据是进行类似push的操作,为了匹配php,我们进行加了[]  ,这个操作.!

  9. hibernateHQL语句

    一.hql 1. 什么是hql HQL是Hibernate Query Language的缩写 查全部 2. hql和sql区别/异同 HQL SQL 类名/属性 表名/列名 区分大小写,关键字不区分 ...

  10. nginx syslog 配置

    以下是一个简单的实践,主要是打算测试nginx 与graylog 的集成,为了简单都是使用容器运行的,同时也测试了 nginx 对于配置多个access_log 的处理 环境准备 docker-com ...