时间线:
- 我从 Ubuntu 14.04 升级到了 16.04。
- 它成功升级,但有一些与 Python 相关的错误。所以我的
reboot
系统。(这是我的错误) - 现在我看到了:
/dev/sda8: clean, xxxx/xxxxx files, xxxx/xxxxx blocks
永无止境的黑屏。 - 我按下
Alt+Ctrl+F1
了命令行。我关注并尝试了许多 askubuntu 帖子来寻找解决方案比如重新安装 python2.7等等apt-get dpkg
。sudo apt-get -f install
但是,似乎没有解决方案可以解决我的问题。
当我这样做时sudo apt-get -f install
,我看到:
ImportError: No module named _struct
dpkg: error processing package python-minimal (--configure):
并从位于 的文件runpy.py
、、compileall.py
和生成。struct.py
/usr/local/lib/python2.7/
编辑:
~bash: /opt/ros/indigo/setup.bash: No such file or directory
我登录后也看到了。
编辑2: 由于pastebinit
安装也不起作用,我尝试自己写错误。
.....
.....
Need to get 0 B/13.4 MB of archives
After this operation, 44.7 MB of additional disk space will be used
Do you want to continue? [Y/n] Y
Setting up python-minimal (2.7.11-1)...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/runpy.py", line 174, 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 [pst-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)
编辑3:
lsb_release -a
输出:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
apt-cache policy python-minimal
输出:
python-minimal:
Installed: 2.7.11-1
Candidate: 2.7.11-1
Version table:
*** 2.7.11-1 500
500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status
答案1
在我们的聊天中,问题被归结为一组虚假的 Python 模块,/usr/local/lib/python2.7
它们掩盖了模块,/usr/lib/python2.7
并阻止了新 Python 包和依赖于它们的所有其他包的成功安装。解决方案是
删除“本地” Python 模块,
sudo rm -r /usr/local/lib/python2.7
删除一些阻碍升级过程的低优先级软件包,
sudo apt-get remove texlive\*
恢复包升级过程。
sudo apt-get dist-upgrade -f
为了确保万无一失,我们还删除了 Ubuntu Trusty 硬件支持堆栈的剩余软件包:
sudo apt-get autoremove \*-lts-xenial linux-\*-3.\*