E: O subprocesso / usr / bin / dpkg retornou um código de erro (1) ao tentar executar o apt-get install python3-pexpect

0
:~$ sudo apt-get install python3-pexpect
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pexpect is already the newest version.
The following packages were automatically installed and are no longer required:
  freeglut3-dev libglew-dev libgoogle-perftools4 libtcmalloc-minimal4
  libunwind8 libv8-3.14.5 mongodb mongodb-clients mongodb-dev mongodb-server
  python-bson python-bson-ext python-gridfs python-pyassimp python-pymongo
  python-pymongo-ext ros-indigo-household-objects-database-msgs
  ros-indigo-ompl ros-indigo-pr2-arm-kinematics ros-indigo-pr2-moveit-plugins
  ros-indigo-warehouse-ros texmaker-data
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  python-libxml2 python-samba
The following packages will be upgraded:
  python-libxml2 python-samba
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
6 not fully installed or removed.
Need to get 0 B/1.207 kB of archives.
After this operation, 1.024 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 844116 files and directories currently installed.)
Preparing to unpack .../python-libxml2_2.9.1+dfsg1-3ubuntu4.10_amd64.deb ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/python-libxml2_2.9.1+dfsg1-3ubuntu4.10_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in 
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in 
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Preparing to unpack .../python-samba_2%3a4.3.11+dfsg-0ubuntu0.14.04.12_amd64.deb ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/python-samba_2%3a4.3.11+dfsg-0ubuntu0.14.04.12_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in 
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in 
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/python-libxml2_2.9.1+dfsg1-3ubuntu4.10_amd64.deb
 /var/cache/apt/archives/python-samba_2%3a4.3.11+dfsg-ubuntu0.14.04.12_amd64.deb

E: Sub-process /usr/bin/dpkg returned an error code (1)
    
por Ramesh Kumar 23.09.2017 / 14:06

1 resposta

1

É devido ao erro:

File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:

O mais provável é que ele esteja esperando python2.x em vez de python3.

Você deve vincular /usr/bin/python à versão apropriada. Se não me engano, /usr/bin/python --version produzirá 3.x Então, talvez você precise criar um link simbólico para python2.x:

ls -la /usr/bin/python  # you will see if there's a symlink towards some other file
rm /usr/bin/python      # only if it is a symlink!
ln -s /usr/bin/python2.x /usr/bin/python 

onde 2.x é sua versão do python.

Ou, mais simplesmente, mas você precisa ter ambos 2.xe 3.x instalado:

sudo update-alternatives --config python
    
por dubsauce 06.12.2017 / 14:56