半安裝的 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)被破壞了。

希望有幫助!

相關內容