Debian 8->9 업그레이드 중 Python이 충돌함

Debian 8->9 업그레이드 중 Python이 충돌함

그래서 데비안 8을 9 이하로 업그레이드하려고 합니다.그 지시. 문제가 발생하여 Python이 작동하지 않아 몇 시간이 지나도 고칠 수 없습니다. 일부 샘플:

# apt-get install --fix-broken       
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:
coinor-libcoinmp1v5 kde-style-oxygen kde-style-oxygen-qt4 libboost-date-time1.62.0 libboost-filesystem1.62.0 libboost-iostreams1.62.0
...
libkf5mailcommon5 libkf5mailimporter5 libkf5messagecomposer5 libkf5messagelist5 libkf5sendlater5 libkf5templateparser5 libkjsembed4 libkntlm4
libokularcore7 liborcus-0.11-0 libpagemaker-0.0-0 libspeechd2 libwps-0.4-4
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
accountsservice akonadi-backend-mysql akonadi-server akregator apper appstream appstream-index apt apt-utils ark baloo-kf5 bluedevil bluez
...
python-mpi4py python-scipy python3 python3-apt python3-cffi-backend python3-chardet python3-crypto python3-cryptography python3-dbus
python3-debian python3-decorator python3-dev python3-gi python3-idna python3-joblib python3-keyring python3-keyrings.alt python3-minimal
python3-nose python3-numpy python3-pkg-resources python3-py python3-pyasn1 python3-pycurl python3-pyqt4 python3-pyqt5 python3-pytest
python3-secretstorage python3-setuptools python3-simplejson python3-sip python3-six python3-software-properties python3-wheel python3-xdg
python3.5 python3.5-dev qapt-batch qdbus qdbus-qt5 qml-module-org-kde-activities qml-module-org-kde-bluezqt qml-module-org-kde-draganddrop
...
task-ssh-server tasksel tasksel-data uno-libs3 ure user-manager vlc vlc-bin vlc-data vlc-l10n vlc-nox vlc-plugin-base vlc-plugin-notify
vlc-plugin-qt vlc-plugin-samba vlc-plugin-video-output
Suggested packages:
gnome-control-center akonadi-backend-postgresql akonadi-backend-sqlite limba apt-doc powermgmt-base pulseaudio-module-bluetooth bluez-alsa
...
vlc-plugin-skins2 vlc-plugin-video-splitter vlc-plugin-visualization
The following packages will be REMOVED:
aptitude coinor-libcoinmp1 coinor-libcoinutils3 coinor-libosi1 gparted juk k3b k3b-i18n kaccessible katepart kde-baseapps kde-baseapps-bin
...
task-kde-desktop vlc-plugin-pulse
The following NEW packages will be installed:
accountsservice appstream baloo-kf5 bluedevil bluez bluez-obexd breeze breeze-cursor-theme breeze-icon-theme catdoc coinor-libcoinmp1v5
...
python3-cffi-backend python3-crypto python3-cryptography python3-idna python3-keyring python3-keyrings.alt python3-py python3-pyasn1
python3-pycurl python3-pytest python3-secretstorage python3-xdg python3.5 python3.5-dev qdbus-qt5 qml-module-org-kde-activities
...
python3-debian python3-decorator python3-dev python3-gi python3-joblib python3-minimal python3-nose python3-numpy python3-pkg-resources
python3-pyqt4 python3-pyqt5 python3-setuptools python3-simplejson python3-sip python3-six python3-software-properties python3-wheel qapt-batch
qdbus qml-module-qtquick-controls qml-module-qtquick-layouts qml-module-qtquick-window2 qml-module-qtquick2 qt4-designer qt4-dev-tools
qt4-linguist-tools qt4-qmake qtbase5-dev-tools qtchooser qtcreator qtcreator-data qtdeclarative5-dev-tools qttools5-dev-tools
software-properties-kde sqlitebrowser systemsettings task-desktop task-english task-ssh-server tasksel tasksel-data uno-libs3 ure vlc vlc-data
vlc-nox vlc-plugin-notify vlc-plugin-samba
211 upgraded, 514 newly installed, 165 to remove and 243 not upgraded.
25 not fully installed or removed.
Need to get 0 B/488 MB of archives.
After this operation, 409 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
Reading changelogs... Done
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 223763 files and directories currently installed.)
Preparing to unpack .../software-properties-kde_0.96.20.2-1+deb9u1_all.deb ...
Failed to import the site module
Traceback (most recent call last):
File "/usr/lib/python3.5/site.py", line 580, in <module>
    main()
File "/usr/lib/python3.5/site.py", line 566, in main
    known_paths = addusersitepackages(known_paths)
File "/usr/lib/python3.5/site.py", line 287, in addusersitepackages
    user_site = getusersitepackages()
File "/usr/lib/python3.5/site.py", line 263, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python3.5/site.py", line 253, in getuserbase
    USER_BASE = get_config_var('userbase')
File "/usr/lib/python3.5/sysconfig.py", line 595, in get_config_var
    return get_config_vars().get(name)
File "/usr/lib/python3.5/sysconfig.py", line 538, in get_config_vars
    _init_posix(_CONFIG_VARS)
File "/usr/lib/python3.5/sysconfig.py", line 410, in _init_posix
    from _sysconfigdata import build_time_vars
File "/usr/lib/python3.5/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_m import *
ImportError: No module named '_sysconfigdata_m'
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
Failed to import the site module
Traceback (most recent call last):
File "/usr/lib/python3.5/site.py", line 580, in <module>
    main()
File "/usr/lib/python3.5/site.py", line 566, in main
    known_paths = addusersitepackages(known_paths)
File "/usr/lib/python3.5/site.py", line 287, in addusersitepackages
    user_site = getusersitepackages()
File "/usr/lib/python3.5/site.py", line 263, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python3.5/site.py", line 253, in getuserbase
    USER_BASE = get_config_var('userbase')
File "/usr/lib/python3.5/sysconfig.py", line 595, in get_config_var
    return get_config_vars().get(name)
File "/usr/lib/python3.5/sysconfig.py", line 538, in get_config_vars
    _init_posix(_CONFIG_VARS)
File "/usr/lib/python3.5/sysconfig.py", line 410, in _init_posix
    from _sysconfigdata import build_time_vars
File "/usr/lib/python3.5/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_m import *
ImportError: No module named '_sysconfigdata_m'
dpkg: error processing archive /var/cache/apt/archives/software-properties-kde_0.96.20.2-1+deb9u1_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 1
Failed to import the site module
Traceback (most recent call last):
File "/usr/lib/python3.5/site.py", line 580, in <module>
    main()
File "/usr/lib/python3.5/site.py", line 566, in main
    known_paths = addusersitepackages(known_paths)
File "/usr/lib/python3.5/site.py", line 287, in addusersitepackages
    user_site = getusersitepackages()
File "/usr/lib/python3.5/site.py", line 263, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python3.5/site.py", line 253, in getuserbase
    USER_BASE = get_config_var('userbase')
File "/usr/lib/python3.5/sysconfig.py", line 595, in get_config_var
    return get_config_vars().get(name)
File "/usr/lib/python3.5/sysconfig.py", line 538, in get_config_vars
    _init_posix(_CONFIG_VARS)
File "/usr/lib/python3.5/sysconfig.py", line 410, in _init_posix
    from _sysconfigdata import build_time_vars
File "/usr/lib/python3.5/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_m import *
ImportError: No module named '_sysconfigdata_m'
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/software-properties-kde_0.96.20.2-1+deb9u1_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

개별 패키지에도 적용됩니다.

# apt-get install --reinstall python3-minimal
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
apper : Depends: packagekit (>= 0.8.6) but it is not going to be installed
python3 : Depends: python3-minimal (= 3.4.2-2) but 3.5.3-1 is to be installed
software-properties-kde : Depends: python3-software-properties (= 0.96.20.2-1+deb9u1) but 0.92.25debian1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

기본적으로 python3 또는 python을 사용하여 위와 동일합니다.

# dpkg --remove --force-remove-reinstreq --force-depends python3            
dpkg: python3: dependency problems, but removing anyway as you requested:
python3-pygments depends on python3:any (>= 3.3.2-2~).
software-properties-common depends on python3 (>= 3.2.3-3~).
python3-joblib depends on python3:any (>= 3.3.2-2~).
python3-debian depends on python3:any (>= 3.3.2-2~); however:
Package python3 is to be removed.
python3-ptyprocess depends on python3:any (>= 3.3.2-2~).
python3-traitlets depends on python3:any (>= 3.3.2-2~); however:
Package python3 is to be removed.
python3-decorator depends on python3 (>= 3.2.3-3~).
dh-python depends on python3:any (>= 3.3.2-2~).
debian-goodies depends on python3.
python3-pykde4 depends on python3 (<< 3.5).
python3-pykde4 depends on python3 (>= 3.4~).
python3-pykde4 depends on python3 (<< 3.5).
python3-pykde4 depends on python3 (>= 3.4~).
python3-setuptools depends on python3:any (>= 3.3).
python3-setuptools depends on python3:any (<< 3.5).
python3-setuptools depends on python3:any (>= 3.3).
python3-setuptools depends on python3:any (<< 3.5).
python3-software-properties depends on python3 (>= 3.2.3-3~).
python3-sip depends on python3 (>= 3.4~).
python3-sip depends on python3 (<< 3.5).
python3-sip depends on python3 (>= 3.4~).
python3-sip depends on python3 (<< 3.5).
unattended-upgrades depends on python3.
python3-pip depends on python3:any (>= 3.4~).
python3-chardet depends on python3.
python3-chardet depends on python3:any (>= 3.3.2-2~).
python3-chardet depends on python3.
python3-chardet depends on python3:any (>= 3.3.2-2~).
python3-pexpect depends on python3:any (>= 3.3.2-2~); however:
Package python3 is to be removed.
python3-nose depends on python3; however:
Package python3 is to be removed.
python3-nose depends on python3:any (>= 3.3.2-2~); however:
Package python3 is to be removed.
python3-nose depends on python3; however:
Package python3 is to be removed.
python3-nose depends on python3:any (>= 3.3.2-2~); however:
Package python3 is to be removed.
python3-ipython-genutils depends on python3:any (>= 3.3.2-2~).
python3-uno depends on python3 (>= 3.4~).
python3-uno depends on python3 (<< 3.5).
python3-uno depends on python3 (>= 3.4~).
python3-uno depends on python3 (<< 3.5).
python3-pyqt4 depends on python3 (>= 3.4~).
python3-pyqt4 depends on python3 (<< 3.5).
python3-pyqt4 depends on python3 (>= 3.4~).
python3-pyqt4 depends on python3 (<< 3.5).
python3-wcwidth depends on python3:any (>= 3.3.2-2~).
lsb-release depends on python3:any (>= 3.4~).
python3-gi depends on python3 (>= 3.4~).
python3-gi depends on python3 (<< 3.5).
python3-gi depends on python3 (>= 3.4~).
python3-gi depends on python3 (<< 3.5).
python3-pkg-resources depends on python3:any (>= 3.3).
python3-pkg-resources depends on python3:any (<< 3.5).
python3-pkg-resources depends on python3:any (>= 3.3).
python3-pkg-resources depends on python3:any (<< 3.5).
python3-wheel depends on python3:any (>= 3.3.2-2~).
python3-wheel depends on python3.
python3-wheel depends on python3:any (>= 3.3.2-2~).
python3-wheel depends on python3.
gdebi-core depends on python3:any (>= 3.3.2-2~).
software-properties-kde depends on python3 (>= 3.2.3-3~).
python3-dev depends on python3 (= 3.4.2-2).
python3-six depends on python3:any (>= 3.3.2-2~).
python3-simplejson depends on python3 (>= 3.4~).
python3-simplejson depends on python3 (<< 3.5).
python3-simplejson depends on python3 (>= 3.4~).
python3-simplejson depends on python3 (<< 3.5).
python3-pyqt5 depends on python3 (>= 3.4~).
python3-pyqt5 depends on python3 (<< 3.5).
python3-pyqt5 depends on python3 (>= 3.4~).
python3-pyqt5 depends on python3 (<< 3.5).
python3-numpy depends on python3 (>= 3.4~).
python3-numpy depends on python3 (<< 3.5).
python3-numpy depends on python3 (>= 3.4~).
python3-numpy depends on python3 (<< 3.5).
python3-ipython depends on python3:any (>= 3.3.2-2~); however:
Package python3 is to be removed.
ipython3 depends on python3:any (>= 3.3.2-2~); however:
Package python3 is to be removed.
python3-dbus depends on python3 (<< 3.5).
python3-dbus depends on python3 (>= 3.4~).
python3-dbus depends on python3 (<< 3.5).
python3-dbus depends on python3 (>= 3.4~).
python3-apt depends on python3 (<< 3.5).
python3-apt depends on python3 (>= 3.4~).
python3-apt depends on python3 (<< 3.5).
python3-apt depends on python3 (>= 3.4~).
python3-prompt-toolkit depends on python3:any (>= 3.3.2-2~); however:
Package python3 is to be removed.
python3-simplegeneric depends on python3 (>= 3.1.3-13~).
python3-pickleshare depends on python3:any (>= 3.3.2-2~).

(Reading database ... 223763 files and directories currently installed.)
Removing python3 (3.4.2-2) ...
Failed to import the site module
Traceback (most recent call last):
File "/usr/lib/python3.5/site.py", line 580, in <module>
    main()
File "/usr/lib/python3.5/site.py", line 566, in main
    known_paths = addusersitepackages(known_paths)
File "/usr/lib/python3.5/site.py", line 287, in addusersitepackages
    user_site = getusersitepackages()
File "/usr/lib/python3.5/site.py", line 263, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python3.5/site.py", line 253, in getuserbase
    USER_BASE = get_config_var('userbase')
File "/usr/lib/python3.5/sysconfig.py", line 595, in get_config_var
    return get_config_vars().get(name)
File "/usr/lib/python3.5/sysconfig.py", line 538, in get_config_vars
    _init_posix(_CONFIG_VARS)
File "/usr/lib/python3.5/sysconfig.py", line 410, in _init_posix
    from _sysconfigdata import build_time_vars
File "/usr/lib/python3.5/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_m import *
ImportError: No module named '_sysconfigdata_m'
dpkg: error processing package python3 (--remove):
subprocess installed pre-removal script returned error exit status 1
Failed to import the site module
Traceback (most recent call last):
File "/usr/lib/python3.5/site.py", line 580, in <module>
    main()
File "/usr/lib/python3.5/site.py", line 566, in main
    known_paths = addusersitepackages(known_paths)
File "/usr/lib/python3.5/site.py", line 287, in addusersitepackages
    user_site = getusersitepackages()
File "/usr/lib/python3.5/site.py", line 263, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python3.5/site.py", line 253, in getuserbase
    USER_BASE = get_config_var('userbase')
File "/usr/lib/python3.5/sysconfig.py", line 595, in get_config_var
    return get_config_vars().get(name)
File "/usr/lib/python3.5/sysconfig.py", line 538, in get_config_vars
    _init_posix(_CONFIG_VARS)
File "/usr/lib/python3.5/sysconfig.py", line 410, in _init_posix
    from _sysconfigdata import build_time_vars
File "/usr/lib/python3.5/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_m import *
ImportError: No module named '_sysconfigdata_m'
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
python3

이것을 시도했지만 또 다른 패키지 누락 오류가 발생합니다.

# ln -fs /usr/lib/python3.5/plat-x86_64-linux-gnu/_sysconfigdata_m.py /usr/lib/python3.5/

지금은 많은 것들이 깨졌습니다.

# lsb_release -a
Failed to import the site module
Traceback (most recent call last):
File "/usr/lib/python3.5/site.py", line 580, in <module>
    main()
File "/usr/lib/python3.5/site.py", line 566, in main
    known_paths = addusersitepackages(known_paths)
File "/usr/lib/python3.5/site.py", line 287, in addusersitepackages
    user_site = getusersitepackages()
File "/usr/lib/python3.5/site.py", line 263, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
File "/usr/lib/python3.5/site.py", line 253, in getuserbase
    USER_BASE = get_config_var('userbase')
File "/usr/lib/python3.5/sysconfig.py", line 595, in get_config_var
    return get_config_vars().get(name)
File "/usr/lib/python3.5/sysconfig.py", line 538, in get_config_vars
    _init_posix(_CONFIG_VARS)
File "/usr/lib/python3.5/sysconfig.py", line 410, in _init_posix
    from _sysconfigdata import build_time_vars
File "/usr/lib/python3.5/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_m import *
ImportError: No module named '_sysconfigdata_m'

하지만 업그레이드가 이미 절반 정도 진행되었습니다.

# cat /etc/issue
Debian GNU/Linux 9 \n \l

# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"


# ll $(which python)
lrwxrwxrwx 1 root root 9 Jan 24  2017 /usr/bin/python -> python2.7*
# ll $(which python3)
-rwxr-xr-x 1 root root 11855256 Jun 13  2019 /usr/bin/python3*

설치 프로그램이 Python(예: 2.7) 대신 깨진 Python3을 사용하도록 고집하는 이유는 무엇입니까? 이 혼란을 어떻게 해결합니까?

편집하다:

# apt policy python3
E: Invalid operation policy
# apt-cache policy python3
python3:
  Installed: 3.4.2-2
  Candidate: 3.5.3-1
  Version table:
     3.5.3-1 0
        500 http://httpredir.debian.org/debian/ stretch/main amd64 Packages
 *** 3.4.2-2 0
        100 /var/lib/dpkg/status

# uname -a
Linux myserver2c 3.16.0-11-amd64 #1 SMP Debian 3.16.84-1 (2020-06-09) x86_64 GNU/Linux

답변1

문제는 올바르게 설정되지 않은 보안 저장소에서 발생합니다.

에 설명된 대로 다음 줄을 바꿉니다.웹 페이지:

deb http://security.debian.org stretch/updates main contrib non-free

그리고:

deb http://security.debian.org/debian-security stretch/updates main contrib non-free

그런 다음 다음을 실행하십시오.

sudo apt update
sudo apt dist-upgrade

Python 오류를 해결하려면 python2.7로 전환하세요. 바라보다Ubuntu에서 Python3 기본 버전 변경. 그런 다음 /var/lib/dpkg/info/python3.postinst다음 내용으로 하나를 만듭니다 .

#!/bin/bash
/bin/true

그런 다음 다음을 실행하십시오.

sudo dpkg --configure -a
sudo apt update
sudo apt full-upgrade

그래도 동작하지 않는다면 /var/lib/dpkg/status백업 후 python3을 제거하고 위 명령어를 실행해 보세요.

관련 정보