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. Codeforces J. Monotonic Renumeration(组合)

    题目描述: You are given an array consisting of nmonotonic renumeration as an array b consisting of \(n\) ...

  2. hive 初始化数据库报错

    安装hive,初始化数据库的时候报错 schematool -dbType mysql -initSchema Metastore Connection Driver : com.mysql.cj.j ...

  3. 机房断电,导致xfs文件系统损坏

    记一次机房断电,导致xfs文件系统损坏处理方法 挂载时报以下错误: mount: mount /dev/sdb on /dev/sdb failed: Structure needs cleaning ...

  4. Linux中在vim/vi模式下对文本的查找和替换

    查找: 1.vim  filename  进入一般模式下 2.查找和替换方法 /word    向下查找word 的字符串  例如  /chengtingting   向下查找字符chengtingt ...

  5. python字符的表示格式

    %% 百分号标记 #就是输出一个% %c 字符及其ASCII码%s 字符串%d 有符号整数(十进制)%u 无符号整数(十进制)%o 无符号整数(八进制)%x 无符号整数(十六进制)%X 无符号整数(十 ...

  6. xml的运用

    <?xml version="1.0" encoding="utf-8"?><class> <student> <na ...

  7. 让更多浏览器支持html5元素的简单方法

    当我们试图使用web上的新技术的时候,旧式浏览器总是我们心中不可磨灭的痛!事实上,所有浏览器都有或多或少的问题,现在还没有浏览器能够完整的识别和支持最新的html5结构元素.但是不用担心,你依然可以在 ...

  8. CORS 跨域 node |XMLHttpRequest 跨域提交数据 node

    node服务端 app.post('/getdata',function(req,res,next){ req.setEncoding('utf8'); res.setHeader('Access-C ...

  9. 前端知识--控制input按钮的可用和不可用

    最近在项目的开发的时候,自己虽然是写后端的,但是,在开发核心的时候,前端的知识自己还是会用到的,多以前端这块自己由于好长时间都没有去看,所以几乎已经忘记的差不多了,现在也只能是想起一点记录一点,以便能 ...

  10. Cocos2d-x学习小结 开始篇

    Cocos2d-x学习小结 开始篇 想要学习Cocos2d-x,是因为在高中物理课上找不到某些物理定律的证明,例如欧姆定律. 为此,我翻阅了稍高等级的物理教材,其中关于欧姆定律\(R=\frac{U} ...