절반만 설치된 Python 패키지 및 순환 종속성

절반만 설치된 Python 패키지 및 순환 종속성

Ubuntu 12.04에서 12.10으로 업데이트하는 동안 문제가 발생했습니다.

root@ely:/sys/bus/usb/devices# dpkg -l | grep ^i[HUFW]
iU  libpython2.7                           2.7.3-0ubuntu3.4                        Shared Python runtime library (version 2.7)
iU  python                                 2.7.3-0ubuntu2.2                        interactive high-level object-oriented language (default version)
iU  python-all                             2.7.3-0ubuntu2.2                        package depending on all supported Python runtime versions
iU  python-all-dev                         2.7.3-0ubuntu2.2                        package depending on all supported Python development packages
iU  python-dev                             2.7.3-0ubuntu2.2                        header files and a static library for Python (default)
iU  python-minimal                         2.7.3-0ubuntu2.2                        minimal subset of the Python language (default version)
iU  python2.7                              2.7.3-0ubuntu3.4                        Interactive high-level object-oriented language (version 2.7)
iU  python2.7-dev                          2.7.3-0ubuntu3.4                        Header files and a static library for Python (v2.7)
iF  python2.7-minimal                      2.7.3-0ubuntu3.4                        Minimal subset of the Python language (version 2.7)

python2.7-minimal 및 python-minimal 패키지를 구성하려고 하면 순환 종속성과 유사한 결과가 나타납니다.

root@ely:~# sudo dpkg --configure python2.7-minimal
dpkg: dependency problems prevent configuration of python2.7-minimal:
 python2.7-minimal depends on python-minimal (>= 2.6.6-3+squeeze1); however:
  Package python-minimal is not configured yet.
dpkg: error processing python2.7-minimal (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python2.7-minimal


root@ely:~# sudo dpkg --configure python-minimal
dpkg: dependency problems prevent configuration of python-minimal:
 python-minimal depends on python2.7-minimal (>= 2.7.3); however:
  Package python2.7-minimal is not configured yet.
dpkg: error processing python-minimal (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python-minimal

python2.7-minimal <-> python.minimal 종속성을 어떻게 해결합니까? 둘째, iU 및 iF 표시 패키지를 어떻게 풀거나 구성합니까? 이 인스턴스에서는 아무것도 재구성하거나 설치할 수 없습니다. 감사해요.

업데이트: 필수적이며 제거할 수 없는 python-minimal을 제외하고 위의 모든 패키지를 제거했습니다. 패키지를 다시 설치하면 다음과 같은 결과가 나타납니다.

Processing triggers for man-db ...
Setting up python2.7-minimal (2.7.3-0ubuntu3.4) ...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site.py", line 563, in <module>
    main()
  File "/usr/local/lib/python2.7/site.py", line 545, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/local/lib/python2.7/site.py", line 278, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/local/lib/python2.7/site.py", line 253, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/local/lib/python2.7/site.py", line 243, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/local/lib/python2.7/sysconfig.py", line 520, in get_config_var
    return get_config_vars().get(name)
  File "/usr/local/lib/python2.7/sysconfig.py", line 419, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/local/lib/python2.7/sysconfig.py", line 298, in _init_posix
    raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/local/include/python2.7/pyconfig.h     (No such file or directory)
    dpkg: error processing python2.7-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-minimal:
 python-minimal depends on python2.7-minimal (>= 2.7.3); however:
  Package python2.7-minimal is not configured yet.
dpkg: error processing python-minimal (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 python2.7-minimal
 python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

이제 나는 상태로 돌아왔습니다.

root@ely:~# dpkg -l | grep ^i[HUFW]
iU  python-minimal                         2.7.3-0ubuntu2.2                        minimal     subset of the Python language (default version)
iF  python2.7-minimal                      2.7.3-0ubuntu3.4                        Minimal subset of the Python language (version 2.7)

그래서 범인은 압축이 풀린 python-minimal 라이브러리라고 생각합니다. 포장을 풀거나 이 문제를 해결하려면 어떻게 해야 합니까?

답변1

비슷한 문제가 있습니다.

그리고 Python을 실행했을 때 발견한 사실은 다음과 같습니다.

# python
ImportError: No module named site

하지만 기본 환경 변수를 사용하면 작동합니다.

# python -E
Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

그래서 $PYTHONPATH와 $PYTHONHOME을 모두 /usr/lib/python2.7로 설정했습니다.

# export PYTHONPATH=/usr/lib/python2.7
# export PYTHONHOME=/usr/lib/python2.7

그런 다음 Python을 다시 설치하십시오.

# aptitude install python2.7

나는 apt-get/aptitude가 Python에 의존한다고 생각하지만 Python이 손상되었습니다.

이것이 도움이 되기를 바랍니다!

관련 정보