当我尝试运行时:
$ gnome-tweak-tool
Traceback (most recent call last):
File "/usr/bin/gnome-tweak-tool", line 26, in <module>
import gtweak
ImportError: No module named 'gtweak'
然后当我尝试删除时我得到:
$ sudo apt-get remove --purge gnome-tweak-tool
The following packages will be REMOVED:
gnome-tweak-tool*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 1,005 kB disk space will be freed.
Do you want to continue? [Y/n] Y
dpkg: error processing package gnome-tweak-tool (--remove):
package is in a very bad inconsistent state; you should
reinstall it before attempting a removal
Errors were encountered while processing:
gnome-tweak-tool
E: Sub-process /usr/bin/dpkg returned an error code (1)
当我尝试重新安装时
$ sudo apt-get install gnome-tweak-tool
Reading package lists... Done
Building dependency tree
Reading state information... Done
gnome-tweak-tool is already the newest version (3.20.1-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/170 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
dpkg: error processing package gnome-tweak-tool (--configure):
package is in a very bad inconsistent state; you should
reinstall it before attempting configuration
Errors were encountered while processing:
gnome-tweak-tool
E: Sub-process /usr/bin/dpkg returned an error code (1)
因为我想安装并运行其他软件包,所以我这样做了:
$ sudo gedit /var/lib/dpkg/status
找到 gnome-tweak 包,删除有关它的整个信息块并保存文件。
我早些时候在 Python 中做了一些更改来安装一些软件。我想我将 Python3 设为默认,但我记不清具体情况了。我有一段时间没有研究过调整工具了。现在我需要帮助让它工作。我该怎么办?
重新安装的结果
sudo apt-get install --reinstall gnome-tweak-tool
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
gnome-tweak-tool
0 upgraded, 1 newly installed, 0 to remove and 9 not upgraded.
15 not fully installed or removed.
Need to get 0 B/170 kB of archives.
After this operation, 1,005 kB of additional disk space will be used.
Selecting previously unselected package gnome-tweak-tool.
(Reading database ... 512559 files and directories currently installed.)
Preparing to unpack .../gnome-tweak-tool_3.20.1-1_all.deb ...
Unpacking gnome-tweak-tool (3.20.1-1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for ureadahead (0.100.0-19) ...
ureadahead will be reprofiled on next reboot
Processing triggers for desktop-file-utils (0.23-1ubuntu1.1) ...
Setting up linux-libc-dev:amd64 (4.8.0-46.49) ...
Setting up linux-libc-dev:i386 (4.8.0-46.49) ...
Setting up gnome-tweak-tool (3.20.1-1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error processing package gnome-tweak-tool (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for bamfdaemon (0.5.3+16.10.20160929-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for libc-bin (2.24-3ubuntu2) ...
Setting up linux-tools-common (4.8.0-46.49) ...
Processing triggers for systemd (231-9ubuntu3) ...
Setting up lightdm (1.19.5-0ubuntu1.1) ...
Setting up liblightdm-gobject-1-0:amd64 (1.19.5-0ubuntu1.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu4) ...
Processing triggers for dbus (1.10.10-1ubuntu1.1) ...
Processing triggers for hicolor-icon-theme (0.15-1) ...
Setting up linux-image-4.8.0-46-generic (4.8.0-46.49) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
update-initramfs: Generating /boot/initrd.img-4.8.0-46-generic
W: plymouth module (/usr/lib/x86_64-linux-gnu/plymouth//.so) missing, skipping that theme.
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.8.0-46-generic
Found initrd image: /boot/initrd.img-4.8.0-46-generic
Found linux image: /boot/vmlinuz-4.8.0-45-generic
Found initrd image: /boot/initrd.img-4.8.0-45-generic
Found linux image: /boot/vmlinuz-4.8.0-44-generic
Found initrd image: /boot/initrd.img-4.8.0-44-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
Setting up linux-headers-4.8.0-46 (4.8.0-46.49) ...
Setting up linux-tools-4.8.0-46 (4.8.0-46.49) ...
Setting up linux-tools-4.8.0-46-generic (4.8.0-46.49) ...
Setting up linux-headers-4.8.0-46-generic (4.8.0-46.49) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
Setting up linux-image-extra-4.8.0-46-generic (4.8.0-46.49) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
update-initramfs: Generating /boot/initrd.img-4.8.0-46-generic
W: plymouth module (/usr/lib/x86_64-linux-gnu/plymouth//.so) missing, skipping that theme.
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.8.0-46-generic /boot/vmlinuz-4.8.0-46-generic
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-4.8.0-46-generic
Found initrd image: /boot/initrd.img-4.8.0-46-generic
Found linux image: /boot/vmlinuz-4.8.0-45-generic
Found initrd image: /boot/initrd.img-4.8.0-45-generic
Found linux image: /boot/vmlinuz-4.8.0-44-generic
Found initrd image: /boot/initrd.img-4.8.0-44-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done
Setting up linux-image-generic (4.8.0.46.58) ...
Setting up linux-tools-virtual (4.8.0.46.58) ...
Setting up linux-headers-generic (4.8.0.46.58) ...
Setting up linux-generic (4.8.0.46.58) ...
Processing triggers for libc-bin (2.24-3ubuntu2) ...
Errors were encountered while processing:
gnome-tweak-tool
E: Sub-process /usr/bin/dpkg returned an error code (1)
athul@black-box:~$ gnome-tweak-tool
Traceback (most recent call last):
File "/usr/bin/gnome-tweak-tool", line 26, in <module>
import gtweak
ImportError: No module named 'gtweak'
Python 输出
athul@black-box:~$ python --version
Python 3.5.2+
athul@black-box:~$ readlink -f "$(which python)"
/usr/bin/python3.5
athul@black-box:~$ which python
/usr/bin/python
athul@black-box:~$ readlink "$(which python)"
/usr/bin/python3
答案1
本文第一部分(将 Python 3 设为默认)“如何在 Ubuntu 14.04 上设置没有框架的 Apache、MySQL 和 Python(LAMP)服务器“是多余且有害的废话,因为大量系统工具依赖于/usr/bin/python
Python 2.7,而这是 Python 本身对标准化运行环境的要求。
您可以使用以下任一方法恢复该步骤:
将符号链接恢复为其先前的目标:
sudo ln -sf python2 /usr/bin/python
重新安装
python-minimal
包:sudo apt-get install -f --reinstall python-minimal
另外,你可以编辑步骤 5 的 Python 脚本的第一行以读取
#!/usr/bin/python3
并且 Python-on-Apache 设置仍应像以前一样工作。