之前升级了,但软件中心一直运行不起来,按照如下指令重装报错。
sudo apt-get install --reinstall software-center
Setting up software-center (16.01+16.04.20160420) ...
File "/usr/sbin/update-software-center", line 83
except Exception, e:
^
SyntaxError: invalid syntax
最后我的问题和解决办法,是因为我的系统安装了各式各样的python,而16.04默认的版本还是2.7,所以需要手动切换回2.7再强制安装,通过update-alternatives来管理
sudo update-alternatives --config python
Selection Path Priority Status
------------------------------------------------------------
0 /usr/local/bin/python3.7 4 auto mode
1 /usr/bin/python2.7 1 manual mode
* 2 /usr/bin/python3.5 2 manual mode
3 /usr/local/bin/python3.6 3 manual mode
4 /usr/local/bin/python3.7 4 manual mode
选择2.7后再次安装,启动正常。
后记
我最近用apt update&apt upgrade总失败,提示
Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/xenial-updates/restricted/dep11/Components-amd64.yml Could not open file /var/lib/apt/lists/partial/cn.archive.ubuntu.com_ubuntu_dists_xenial-updates_restricted_dep11_Components-amd64.yml.gz - open (13: Permission denied)
按照这个办法:
sudo rm -rf /var/lib/apt/lists/*
sudo apt update
同步就正常了,亲测有效