1 votes

Je n'arrive pas à installer quoi que ce soit dans Ubuntu 16.04 "Alwas show the same error".

Lorsque je lance cette commande :

sudo apt-get autoremove

La sortie correspondante indiquera :

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)

J'ai également essayé d'exécuter la réponse de "Neil" à partir de :

Erreurs de dépendance après l'installation et la tentative de suppression de Google Chrome

Le résultat est le suivant :

    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)

J'ai essayé de nettoyer apt en utilisant

sudo apt-get clean

J'ai également essayé

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:~$

Comment puis-je installer quoi que ce soit dans mon Ubuntu 16.04 ?

2voto

Robert Points 91

Il semble que vous ayez installé python3 à un moment donné. Python n'est pas rétrocompatible, donc un script écrit pour python2 ne fonctionnera pas avec python3.

Faites d'abord un "Python --version" et assurez-vous que c'est bien le cas. Il y a de fortes chances que vous obteniez quelque chose comme ceci qui montre python3.x

desktop:~$ python --version
Python 3.5.2

Assurez-vous également que vous avez toujours python2 :

desktop:~$ python2 --version
Python 2.7.12

Pour résoudre ce problème, j'ai dû créer un nouveau lien symbolique pour /usr/bin/Python, pointant vers python2 à la place.

sudo ln -sf /usr/bin/python2 /usr/bin/python

Pour s'assurer que cela a fonctionné, il suffit de refaire un 'Python --version' et de s'assurer qu'il s'agit bien de la version 2.x.

SistemesEz.com

SystemesEZ est une communauté de sysadmins où vous pouvez résoudre vos problèmes et vos doutes. Vous pouvez consulter les questions des autres sysadmins, poser vos propres questions ou résoudre celles des autres.

Powered by:

X