安裝Python時遇到如下問題,解決方案


~$ sudo apt-get install python-pip
正在讀取軟件包列表... 完成
正在分析軟件包的依賴關系樹       
正在讀取狀態信息... 完成       
python-pip 已經是最新的版本了。
升級了 0 個軟件包,新安裝了 0 個軟件包,要卸載 0 個軟件包,有 233 個軟件包未被升級。
有 8 個軟件包沒有被完全安裝或卸載。
解壓縮后會消耗掉 0 B 的額外空間。
您希望繼續執行嗎? [Y/n] Y
正在設置 mercurial-common (2.8.2-1ubuntu1.3) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 38, in <module>
    from debpython.namespace import add_namespace_files
ImportError: No module named 'debpython.namespace'
dpkg: 處理軟件包 mercurial-common (--configure)時出錯:
 子進程 已安裝 post-installation 腳本 返回了錯誤號 1
dpkg: 依賴關系問題使得 mercurial 的配置工作不能繼續:
 mercurial 依賴於 mercurial-common (= 2.8.2-1ubuntu1.3);然而:
  軟件包 mercurial-common 尚未配置。

dpkg: 處理軟件包 mercurial (--configure)時出錯:
 依賴關系問題 - 仍未被配置
正在設置 python-colorama (0.2.5-0.1ubuntu2) ...
因為錯誤消息指示這是由於上一個問題導致的錯誤,沒有寫入 apport 報告。
                                                                    Traceback (most recent call last):
  File "/usr/bin/pycompile", line 38, in <module>
    from debpython.namespace import add_namespace_files
ImportError: No module named 'debpython.namespace'
dpkg: 處理軟件包 python-colorama (--configure)時出錯:
 子進程 已安裝 post-installation 腳本 返回了錯誤號 1
正在設置 python-distlib (0.1.8-1ubuntu1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 38, in <module>
    from debpython.namespace import add_namespace_files
ImportError: No module named 'debpython.namespace'
由於已經達到 MaxReports 限制,沒有寫入 apport 報告。
                                                    dpkg: 處理軟件包 python-distlib (--configure)時出錯:
 子進程 已安裝 post-installation 腳本 返回了錯誤號 1
正在設置 python-html5lib (0.999-3~ubuntu1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 38, in <module>
    from debpython.namespace import add_namespace_files
ImportError: No module named 'debpython.namespace'
dpkg: 處理軟件包 python-html5lib (--configure)時出錯:
 子進程 已安裝 post-installation 腳本 返回了錯誤號 1
由於已經達到 MaxReports 限制,沒有寫入 apport 報告。
                                                    正在設置 python-setuptools (3.3-1ubuntu2) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 38, in <module>
    from debpython.namespace import add_namespace_files
ImportError: No module named 'debpython.namespace'
由於已經達到 MaxReports 限制,沒有寫入 apport 報告。
                                                    由於已經達到 MaxReports 限制,沒有寫入 apport 報告。
                        dpkg: 處理軟件包 python-setuptools (--configure)時出錯:
 子進程 已安裝 post-installation 腳本 返回了錯誤號 1
dpkg: 依賴關系問題使得 python-pip 的配置工作不能繼續:
 python-pip 依賴於 python-colorama;然而:
  軟件包 python-colorama 尚未配置。
 python-pip 依賴於 python-distlib;然而:
  軟件包 python-distlib 尚未配置。
 python-pip 依賴於 python-html5lib;然而:
  軟件包 python-html5lib 尚未配置。
 python-pip 依賴於 python-setuptools (>= 0.6c1);然而:
  軟件包 python-setuptools 尚未配置。

dpkg: 處理軟件包 python-pip (--configure)時出錯:
 依賴關系問題 - 仍未被配置
正在設置 python-wheel (0.24.0-1~ubuntu1) ...
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 38, in <module>
    from debpython.namespace import add_namespace_files
ImportError: No module named 'debpython.namespace'
dpkg: 處理軟件包 python-wheel (--configure)時出錯:
 子進程 已安裝 post-installation 腳本 返回了錯誤號 1
由於已經達到 MaxReports 限制,沒有寫入 apport 報告。
                                                    E: Sub-process /usr/bin/dpkg returned an error code (1)

首先輸入:

 sudo dpkg -C 

顯示:

:~$ sudo dpkg -C
下列軟件包已被解開,但是尚未配置。
要令它們運行正常,您必須借助 dpkg --configure
或者 dselect 菜單中的配置項:
 python-pip           alternative Python package installer
 mercurial            easy-to-use, scalable distributed version control system

下列軟件包只是被不全面地配置了,這也許要歸咎於
第一次配置它們時出的問題。您最好能重新配置它們。
借助 dpkg --configure <軟件包名> 或者用 dselect 
菜單中的配置項重新配置軟件包:
 python-distlib       low-level components of python distutils2/packaging
 mercurial-common     easy-to-use, scalable distributed version control system 
 python-colorama      Cross-platform colored terminal text in Python - Python 2
 python-html5lib      HTML parser/tokenizer based on the WHATWG HTML5 specifica
 python-setuptools    Python Distutils Enhancements
 python-wheel         built-package format for Python

分析:

  原因是,我們在將python2.7升級到python3.3時,只是將/usr/local/bin目錄下修改了(使用ln -s 或者其他),然而我們的配置目錄並沒有修改..

使用如下的方式可以有效的解決:

sudo apt-get clean
sudo apt-get update
sudo apt-get install --reinstall python-minimal python-lockfile

 

參考鏈接:http://askubuntu.com/questions/534040/problem-installing-any-new-packages-in-ubuntu-because-of-python


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM