处理时遇到错误:python-minimal

处理时遇到错误:python-minimal

我无法使用 apt-get 做任何事情,因为python-minimal.我想我可能已经损坏了我的蟒蛇!

每当我想使用安装、删除或升级时apt-get,都会出现以下错误:

Errors were encountered while processing:
    python-minimal

我尝试搜索并尝试了我找到的有关此问题的所有解决方案,现在我想彻底卸载并安装新版本的 python。

到目前为止我尝试过这些事情:

首先我安装了 python,每个apt-get命令都会产生以下输出:

所有这些命令:

sudo apt-get autoremove -f
sudo apt-get autoclean # and then install python
sudo apt-get upgrade
sudo apt-get -f install
sudo apt-get download python-minimal; sudo dpkg -i py*deb
sudo apt-get remove python
sudo apt-get autoremove python-minimal
sudo apt-get install --reinstall python-minimal

产生相同的输出:

Setting up python-minimal (2.7.14-1~14.04.york0) ...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/runpy.py", line 162, in 
_run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/compileall.py", line 16, in <module>
    import struct
  File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
    from _struct import *
ImportError: No module named _struct
dpkg: error processing package python-minimal (--configure):
 subprocess installed post-installation script returned error exit 
status 1
Errors were encountered while processing:
 python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

然后我尝试了,,,对我来说没有任何作用。

然后我厌倦了并尝试手动删除 python,所以我使用rm -rf以下命令删除了 python 文件:

sudo apt-get upgrade python -f

结果是:

Setting up python-minimal (2.7.14-1~14.04.york0) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package python-minimal (--configure):
 subprocess installed post-installation script returned error exit 
status 1
Errors were encountered while processing:
 python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

现在当我跑步时sudo apt-get purge python-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:
 python : Depends: python-minimal (= 2.7.5-5ubuntu3) but it is not 
going to be installed
 python-support : Depends: python-minimal but it is not going to be 
installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or 
specify a solution).

跑步后sudo apt-get -f install我得到

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  libpython-stdlib python
Suggested packages:
  python-doc python-tk
The following packages will be upgraded:
  libpython-stdlib python
2 upgraded, 0 newly installed, 0 to remove and 253 not upgraded.
1 not fully installed or removed.
Need to get 0 B/175 kB of archives.
After this operation, 4,096 B disk space will be freed.
Do you want to continue? [Y/n] Y
Setting up python-minimal (2.7.14-1~14.04.york0) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package python-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

编辑:

运行此命令sudo dpkg --configure -a会给出以下输出:

Setting up python-minimal (2.7.14-1~14.04.york0) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package python-minimal (--configure):
 subprocess installed post-installation script returned error exit 
status 1
Errors were encountered while processing:
 python-minimal

相关内容