当我运行这个命令时:
sudo apt-get autoremove
相应的输出将显示:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up dput (0.9.6.4ubuntu3) ...
*** Error compiling '/usr/share/dput/ftp.py'...
File "/usr/share/dput/ftp.py", line 9
print "D: FTP-Connection to host: %s" % fqdn
^
SyntaxError: Missing parentheses in call to 'print'
*** Error compiling '/usr/share/dput/helper/dputhelper.py'...
File "/usr/share/dput/helper/dputhelper.py", line 12
print "Error: Failed to execute '"+file+"'."
^
SyntaxError: Missing parentheses in call to 'print'
*** Error compiling '/usr/share/dput/http.py'...
File "/usr/share/dput/http.py", line 55
except ValueError, e:
^
SyntaxError: invalid syntax
*** Error compiling '/usr/share/dput/https.py'...
File "/usr/share/dput/https.py", line 3
exec open("/usr/share/dput/http.py") in d
^
SyntaxError: invalid syntax
*** Error compiling '/usr/share/dput/local.py'...
File "/usr/share/dput/local.py", line 20
print "D: Uploading with cp to %s" % (incoming)
^
SyntaxError: invalid syntax
*** Error compiling '/usr/share/dput/rsync.py'...
File "/usr/share/dput/rsync.py", line 25
print "D: Uploading with rsync to %s%s:%s" % \
^
SyntaxError: Missing parentheses in call to 'print'
*** Error compiling '/usr/share/dput/scp.py'...
File "/usr/share/dput/scp.py", line 29
if not stat.S_IMODE(os.lstat(file)[stat.ST_MODE])==0644:
^
SyntaxError: invalid token
*** Error compiling '/usr/share/dput/sftp.py'...
File "/usr/share/dput/sftp.py", line 13
except Exception, e:
^
SyntaxError: invalid syntax
dpkg: error processing package dput (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
dput
E: Sub-process /usr/bin/dpkg returned an error code (1)
我也尝试运行“Neil”的回答:
安装并尝试删除 Google Chrome 后出现依赖项错误
输出为:
ashraful@ashraful-Vostro-3458:~$ sudo rm /etc/apt/sources.list
ashraful@ashraful-Vostro-3458:~$ sudo software-properties-gtk
/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py:40: PyGIWarning: Gdk was imported without specifying a version first. Use gi.require_version('Gdk', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import GObject, Gdk, Gtk, Gio, GLib
/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py:40: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import GObject, Gdk, Gtk, Gio, GLib
WARNING:root:could not open file '/etc/apt/sources.list'
WARNING:root:could not open file '/etc/apt/sources.list'
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
ashraful@ashraful-Vostro-3458:~$ sudo apt-get remove --purge google-chrome-stable
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package google-chrome-stable
ashraful@ashraful-Vostro-3458:~$ sudo apt-get update
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial InRelease
Reading package lists... Done
ashraful@ashraful-Vostro-3458:~$ sudo apt-get dist-upgrade -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
libdb5.3:i386 libgcrypt20:i386 libsystemd0:i386
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up dput (0.9.6.4ubuntu3) ...
*** Error compiling '/usr/share/dput/ftp.py'...
File "/usr/share/dput/ftp.py", line 9
print "D: FTP-Connection to host: %s" % fqdn
^
SyntaxError: Missing parentheses in call to 'print'
*** Error compiling '/usr/share/dput/helper/dputhelper.py'...
File "/usr/share/dput/helper/dputhelper.py", line 12
print "Error: Failed to execute '"+file+"'."
^
SyntaxError: Missing parentheses in call to 'print'
*** Error compiling '/usr/share/dput/http.py'...
File "/usr/share/dput/http.py", line 55
except ValueError, e:
^
SyntaxError: invalid syntax
*** Error compiling '/usr/share/dput/https.py'...
File "/usr/share/dput/https.py", line 3
exec open("/usr/share/dput/http.py") in d
^
SyntaxError: invalid syntax
*** Error compiling '/usr/share/dput/local.py'...
File "/usr/share/dput/local.py", line 20
print "D: Uploading with cp to %s" % (incoming)
^
SyntaxError: invalid syntax
*** Error compiling '/usr/share/dput/rsync.py'...
File "/usr/share/dput/rsync.py", line 25
print "D: Uploading with rsync to %s%s:%s" % \
^
SyntaxError: Missing parentheses in call to 'print'
*** Error compiling '/usr/share/dput/scp.py'...
File "/usr/share/dput/scp.py", line 29
if not stat.S_IMODE(os.lstat(file)[stat.ST_MODE])==0644:
^
SyntaxError: invalid token
*** Error compiling '/usr/share/dput/sftp.py'...
File "/usr/share/dput/sftp.py", line 13
except Exception, e:
^
SyntaxError: invalid syntax
dpkg: error processing package dput (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
dput
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试使用以下方法清理 apt
sudo apt-get clean
我也试过
ashraful@ashraful-Vostro-3458:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up dput (0.9.6.4ubuntu3) ...
*** Error compiling '/usr/share/dput/ftp.py'...
File "/usr/share/dput/ftp.py", line 9
print "D: FTP-Connection to host: %s" % fqdn
^
SyntaxError: Missing parentheses in call to 'print'
*** Error compiling '/usr/share/dput/helper/dputhelper.py'...
File "/usr/share/dput/helper/dputhelper.py", line 12
print "Error: Failed to execute '"+file+"'."
^
SyntaxError: Missing parentheses in call to 'print'
*** Error compiling '/usr/share/dput/http.py'...
File "/usr/share/dput/http.py", line 55
except ValueError, e:
^
SyntaxError: invalid syntax
*** Error compiling '/usr/share/dput/https.py'...
File "/usr/share/dput/https.py", line 3
exec open("/usr/share/dput/http.py") in d
^
SyntaxError: invalid syntax
*** Error compiling '/usr/share/dput/local.py'...
File "/usr/share/dput/local.py", line 20
print "D: Uploading with cp to %s" % (incoming)
^
SyntaxError: invalid syntax
*** Error compiling '/usr/share/dput/rsync.py'...
File "/usr/share/dput/rsync.py", line 25
print "D: Uploading with rsync to %s%s:%s" % \
^
SyntaxError: Missing parentheses in call to 'print'
*** Error compiling '/usr/share/dput/scp.py'...
File "/usr/share/dput/scp.py", line 29
if not stat.S_IMODE(os.lstat(file)[stat.ST_MODE])==0644:
^
SyntaxError: invalid token
*** Error compiling '/usr/share/dput/sftp.py'...
File "/usr/share/dput/sftp.py", line 13
except Exception, e:
^
SyntaxError: invalid syntax
dpkg: error processing package dput (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
dput
E: Sub-process /usr/bin/dpkg returned an error code (1)
ashraful@ashraful-Vostro-3458:~$
请帮帮我。如何在 Ubuntu 16.04 中安装任何东西
答案1
看来您一定在某个时候安装了 python3。Python 不向后兼容,因此为 python2 编写的脚本无法在 python3 上运行。
首先执行“python --version”并确保情况确实如此。你很可能会得到类似这样的结果,显示 python3.x
desktop:~$ python --version
Python 3.5.2
另外请确保你仍然有 python2:
desktop:~$ python2 --version
Python 2.7.12
为了解决这个问题,我必须为 /usr/bin/python 创建一个新的符号链接,指向 python2。
sudo ln -sf /usr/bin/python2 /usr/bin/python
确保它有效,只需再次执行“python --version”并确保它是 2.x