:~$ 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 <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 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 <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 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)
答案1
这是由于以下错误造成的:
File "/usr/bin/pyclean", line 63
except (IOError, OSError), e:
最有可能的原因是它期望的是 python2.x 而不是 python3。
您必须链接/usr/bin/python
到适当的版本。如果我没记错的话,/usr/bin/python --version
将输出 3.x,因此您可能需要创建指向 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
2.x
你的 python 版本在哪里?
或者,更简单,但您需要同时安装 2.x 和 3.x:
sudo update-alternatives --config python