【Ubuntu升級python3.5到python3.6】dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Er

 

Ubuntu16.04上將系統自帶的python3.5升級到3.6

安裝aioredis時提示Python版本需>=3.5.3,因此進行升級
命令以下:python

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

注意,安裝python3.6的時候必定要加*,將3.6所需的依賴庫也一塊兒裝上redis

注意,python3.5不要卸載,卸載會損壞系統。bootstrap

# 移除原3.4link 
$ sudo rm /usr/bin/python3

# 更換默認python3 的版本爲3.6
$ sudo ln -s /usr/bin/python3.6 /usr/bin/python3

安裝完Python後pip需從新安裝:ubuntu

$ 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-04ui

在ubuntu上將python3.5升級到python3.6,執行以下命令時,遇到錯誤:this

sudo apt-get install python3.6*
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)

對於這種錯誤,我採起的處理方法是手動強行安裝兩個安裝失敗的包(黃底色紅字部分):spa

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

而後再執行code

sudo apt install -f

而後安裝就沒問題了orm

sudo apt-get install python3.6*

安裝成功!blog

相關文章
相關標籤/搜索