dpkg: error processing archive /var/cache/apt/archives/libpython3.7-stdlib_3.7.3-2~18.04.1_amd64.deb

Posted in :

使用 apt update 和 apt upgrade 遇到error 被中斷,系統提示需要我下這行指令:apt –fix-broken install,執行結果還是被中斷

 Reading package lists… Done
 Building dependency tree       
 Reading state information… Done
 Correcting dependencies… Done
 The following packages were automatically installed and are no longer required:
   libcurses-perl libcurses-ui-perl libterm-readkey-perl linux-image-4.2.0-16-generic
   linux-image-extra-4.2.0-16-generic python3-acme python3-configargparse python3-future python3-josepy
   python3-mock python3-ndg-httpsclient python3-parsedatetime python3-pbr python3-pyasn1 python3-rfc3339
   python3-tz python3.7-distutils python3.7-lib2to3
 Use 'apt autoremove' to remove them.
 The following additional packages will be installed:
   libgcc1 libpython3.7-stdlib libstdc++6
 The following packages will be upgraded:
   libgcc1 libpython3.7-stdlib libstdc++6
 3 upgraded, 0 newly installed, 0 to remove and 79 not upgraded.
 39 not fully installed or removed.
 Need to get 0 B/2,177 kB of archives.
 After this operation, 118 kB disk space will be freed.
 Do you want to continue? [Y/n] Y
 (Reading database … 92541 files and directories currently installed.)
 Preparing to unpack …/libpython3.7-stdlib_3.7.3-2~18.04.1_amd64.deb …
 Unpacking libpython3.7-stdlib:amd64 (3.7.3-2~18.04.1) over (3.7.3-1+xenial1) …
 dpkg: error processing archive /var/cache/apt/archives/libpython3.7-stdlib_3.7.3-2~18.04.1_amd64.deb (--unpack):
  trying to overwrite '/usr/lib/python3.7/distutils/init.py', which is also in package python3.7-distutils 3.7.3-1+xenial1
 dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
 Errors were encountered while processing:
  /var/cache/apt/archives/libpython3.7-stdlib_3.7.3-2~18.04.1_amd64.deb
 E: Sub-process /usr/bin/dpkg returned an error code (1)

發生的原因是因為我在系統上已經安裝了 python 3.7.3 所以蓋不過去的樣子。解法,下指令:

sudo dpkg --install --force all /var/cache/apt/archives/libpython3.7-stdlib_3.7.3-2~18.04.1_amd64.deb

先使用 sudo dpkg –install –force all 把被中斷的 deb 強制執行,系統會彈出提示視窗,問在覆蓋系統檔案時,如果有重開機的需求時,要不要自動幫使用者重開機。

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *