因此,我尝试使用 add-apt-repository 添加存储库,但收到此错误:
sudo add-apt-repository ppa:gijzelaar/opencv2
[sudo] password for foo:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 8, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties
ImportError: No module named softwareproperties.SoftwareProperties
像新手一样,我认为使用 apt 简单地卸载并重新安装 python-software-properties 是一个好主意。
重新安装后,我得到了这个:
foo@ubuntu:/$ sudo apt-get install python-software-properties
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-software-properties is already the newest version.
The following packages were automatically installed and are no longer required:
libswscale0 linux-headers-2.6.38-8-generic libtorque2 libavutil50
libvtk5.4-qt3 fsl-mni-structural-atlas fsl-bangor-cerebellar-atlas
fsl-atlases linux-headers-2.6.38-8 libnewmat10ldbl
fsl-talairach-daemon-atlas fsl-harvard-oxford-atlases libgl2ps0 libcvaux2.1
libgdchart-gd2-noxpm qt3-assistant liblapack3gf fsl-doc-4.1
fsl-oxford-thalamic-connectivity-atlas libmysqlclient16 libavcodec52
fslview-doc tcsh libhighgui2.1 libvtk5.4 libopenmpi1.3 fsl-mni152-templates
fslview libqwt4c2 libcv2.1 libgsm1 libblas3gf libschroedinger-1.0-0
libavformat52 libnuma1 libdc1394-22 qt3-doc libibverbs1 tk8.4 libpq5
libgfortran3 fsl-jhu-dti-whitematter-atlas libva1 libqt3-mt
fsl-juelich-histological-atlas libaudio2 mysql-common libnifti2 libmng1
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.
8 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? Y
Setting up python-software-properties (0.80.9) ...
Traceback (most recent call last):
File "/usr/bin/pycentral", line 2327, in <module>
main()
File "/usr/bin/pycentral", line 2321, in main
rv = action.run(global_options)
File "/usr/bin/pycentral", line 1493, in run
runtimes = get_installed_runtimes()
File "/usr/bin/pycentral", line 278, in get_installed_runtimes
default_version = pyversions.default_version(version_only=True)
File "/usr/share/pycentral-data/pyversions.py", line 172, in default_version
raise ValueError, "/usr/bin/python does not match the python default version. It must be reset to point to %s" % debian_default
ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.7
dpkg: error processing python-software-properties (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-aptdaemon:
python-aptdaemon depends on python-software-properties; however:
Package python-software-properties is not configured yet.
dpkg: error processing python-aptdaemon (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of aptdaemon:
aptdaemon depends on python-aptdaemon (= 0.41+bzr646-0ubuntu2.1); however:
Package python-aptdaemon is not configured yet.
dpkg: error processing aptdaemon (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-aptdaemon.gtkwidgets:
python-aptdaemon.gtkwidgets depends on python-aptdaemon (= 0.41+bzr646-0ubuntu2.1); however:
Package python-aptdaemon is not configured yet.
dpkg: error processing python-aptdaemon.gtkwidgets (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-aptdaemon.gtk3widgets:
python-aptdaemon.gNo apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
tk3widgets depends on python-aptdaemon (= 0.41+bzr646-0ubuntu2.1); however:
Package python-aptdaemon is not configured yet.
dpkg: error processing python-aptdaemon.gtk3widgets (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-aptdaemon-gtk:
python-aptdaemon-gtk depends on python-aptdaemon.gtkwidgets (= 0.41+bzr646-0ubuntu2.1); however:
Package python-aptdaemon.gtkwidgets is not configured yet.
python-aptdaemon-gtk depends on python-aptdaemon.gtk3widgets (= 0.41+bzr646-0ubuntu2.1); however:
Package python-aptdaemon.gtk3widgets is not configured yet.
dpkg: error processing python-aptdaemon-gtk (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of software-center:
software-center depends on python-aptdaemon (>= 0.40); however:
Package python-aptdaemon is not configured yet.
software-center depends on python-aptdaemon-gtk; however:
Package python-aptdaemon-gtk is not configured yet.
software-center depends on aptdaemon (>= 0.40); however:
Package aptdaemon is not configured yet.
dpkg: error processing software-center (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of software-properties-gtk:
software-properties-gtk depends on python-software-properties; however:
Package python-software-properties is not configured yet.
dpkg: error processing software-properties-gtk (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-software-properties
python-aptdaemon
aptdaemon
python-aptdaemon.gtkwidgets
python-aptdaemon.gtk3widgets
python-aptdaemon-gtk
software-center
software-properties-gtk
E: Sub-process /usr/bin/dpkg returned an error code (1) No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
tk3widgets depends on python-aptdaemon (= 0.41+bzr646-0ubuntu2.1); however:
Package python-aptdaemon is not configured yet.
dpkg: error processing python-aptdaemon.gtk3widgets (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-aptdaemon-gtk:
python-aptdaemon-gtk depends on python-aptdaemon.gtkwidgets (= 0.41+bzr646-0ubuntu2.1); however:
Package python-aptdaemon.gtkwidgets is not configured yet.
python-aptdaemon-gtk depends on python-aptdaemon.gtk3widgets (= 0.41+bzr646-0ubuntu2.1); however:
Package python-aptdaemon.gtk3widgets is not configured yet.
dpkg: error processing python-aptdaemon-gtk (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of software-center:
software-center depends on python-aptdaemon (>= 0.40); however:
Package python-aptdaemon is not configured yet.
software-center depends on python-aptdaemon-gtk; however:
Package python-aptdaemon-gtk is not configured yet.
software-center depends on aptdaemon (>= 0.40); however:
Package aptdaemon is not configured yet.
dpkg: error processing software-center (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of software-properties-gtk:
software-properties-gtk depends on python-software-properties; however:
Package python-software-properties is not configured yet.
dpkg: error processing software-properties-gtk (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-software-properties
python-aptdaemon
aptdaemon
python-aptdaemon.gtkwidgets
python-aptdaemon.gtk3widgets
python-aptdaemon-gtk
software-center
software-properties-gtk
E: Sub-process /usr/bin/dpkg returned an error code (1)
我该如何解决这个问题?????我不想重新安装python,因为此时我已经安装了很多包……
太感谢了,
泰勒米勒
编辑:
ls -la /usr/bin/bin/
drwxrwxr-x 3 506 506 4096 2011-08-12 16:51 .
drwxr-xr-x 13 root root 69632 2011-08-31 18:12 ..
-rwxr-xr-x 1 506 506 96 2011-08-12 15:59 2to3
-rwxr-xr-x 1 root root 1086 2011-08-12 16:00 apirst2html.py
-rwxr-xr-x 1 root root 65363 2011-08-12 16:06 ccache-swig
-rwxr-xr-x 1 root root 534 2011-08-12 16:11 ckeygen
-rwxr-xr-x 1 root root 532 2011-08-12 16:11 conch
-rwxr-xr-x 1 root root 197 2011-08-12 16:00 coverage
-rwxr-xr-x 1 root root 232 2011-08-12 16:00 cython
-rwxr-xr-x 1 root root 286 2011-08-12 16:31 easy_install
-rwxr-xr-x 1 root root 294 2011-08-12 16:31 easy_install-2.7
-rwxr-xr-x 1 root root 204 2011-08-12 16:00 egginst
-rwxr-xr-x 1 root root 223 2011-08-12 16:00 endo
-rwxr-xr-x 1 root root 228 2011-08-12 16:00 endo-readstate
-rwxr-xr-x 1 root root 206 2011-08-12 16:00 enpkg
-rwxr-xr-x 1 root root 197 2011-08-12 16:00 epydoc
-rwxr-xr-x 1 root root 197 2011-08-12 16:00 epydocgui
-rwxr-xr-x 1 root root 189 2011-08-12 16:11 ets
-rwxr-xr-x 1 root root 208 2011-08-12 16:00 ets3to4
-rwxr-xr-x 1 root root 194 2011-08-12 16:11 ets-docs
-rwxr-xr-x 1 root root 227 2011-08-12 16:00 ets_endo
-rwxr-xr-x 1 root root 682 2011-08-12 16:05 f2py
-rwxr-xr-x 1 root root 6737 2011-08-12 16:05 fitscheck
-rwxr-xr-x 1 root root 524 2011-08-12 16:11 flappclient
-rwxr-xr-x 1 root root 521 2011-08-12 16:11 flappserver
-rwxr-xr-x 1 root root 521 2011-08-12 16:11 flogtool
-rwxr-xr-x 1 root root 200 2011-08-12 16:09 fwrapc
-rwxr-xr-x 1 root root 47003 2011-08-12 16:01 gif2h5
-rwxr-xr-x 1 root root 201 2011-08-12 16:01 grin
-rwxr-xr-x 1 root root 203 2011-08-12 16:01 grind
-rwxr-xr-x 1 root root 40238 2011-08-12 16:01 h52gif
-rwxr-xr-x 1 root root 9494 2011-08-12 16:01 h5cc
-rwxr-xr-x 1 root root 104953 2011-08-12 16:01 h5copy
-rwxr-xr-x 1 root root 19508 2011-08-12 16:01 h5debug
-rwxr-xr-x 1 root root 196948 2011-08-12 16:01 h5diff
-rwxr-xr-x 1 root root 181410 2011-08-12 16:01 h5dump
-rwxr-xr-x 1 root root 82444 2011-08-12 16:01 h5import
-rwxr-xr-x 1 root root 41356 2011-08-12 16:01 h5jam
-rwxr-xr-x 1 root root 131449 2011-08-12 16:01 h5ls
-rwxr-xr-x 1 root root 102923 2011-08-12 16:01 h5mkgrp
-rwxr-xr-x 1 root root 75467 2011-08-12 16:01 h5perf_serial
-rwxr-xr-x 1 root root 4434 2011-08-12 16:01 h5redeploy
-rwxr-xr-x 1 root root 157141 2011-08-12 16:01 h5repack
-rwxr-xr-x 1 root root 15762 2011-08-12 16:01 h5repart
-rwxr-xr-x 1 root root 114276 2011-08-12 16:01 h5stat
-rwxr-xr-x 1 root root 38241 2011-08-12 16:01 h5unjam
-rwxr-xr-x 1 root root 213 2011-08-12 16:08 helpviewer
-rwxr-xr-x 1 506 506 94 2011-08-12 15:59 idle
-rwxr-xr-x 1 root root 210 2011-08-12 16:08 img2png
-rwxr-xr-x 1 root root 209 2011-08-12 16:08 img2py
-rwxr-xr-x 1 root root 210 2011-08-12 16:08 img2xpm
-rwxr-xr-x 1 root root 253 2011-08-12 16:01 ipcluster
-rwxr-xr-x 1 root root 256 2011-08-12 16:01 ipcontroller
-rwxr-xr-x 1 root root 252 2011-08-12 16:01 ipengine
-rwxr-xr-x 1 root root 252 2011-08-12 16:01 iplogger
-rwxr-xr-x 1 root root 211 2011-08-12 16:01 iptest
-rwxr-xr-x 1 root root 250 2011-08-12 16:01 ipython
-rwxr-xr-x 1 root root 229 2011-08-12 16:01 ipython-qtconsole
-rwxr-xr-x 1 root root 208 2011-08-12 16:01 irunner
-rwxr-xr-x 1 root root 200 2011-08-12 16:06 isympy
-rwxr-xr-x 1 root root 531 2011-08-12 16:11 lore
-rwxr-xr-x 1 root root 24181 2011-08-12 16:07 lproj
-rwxr-xr-x 1 root root 590 2011-08-12 16:11 mailmail
-rwxr-xr-x 1 root root 579 2011-08-12 16:11 manhole
-rwxr-xr-x 1 root root 211 2011-08-12 16:10 mayavi2
-rwxr-xr-x 1 root root 23353 2011-08-12 16:05 miniterm.py
-rwxr-xr-x 1 root root 591 2011-08-12 16:11 mktap
-rwxr-xr-x 1 root root 10109 2011-08-12 16:10 nc3tonc4
-rwxr-xr-x 1 root root 4531 2011-08-12 16:10 nc4tonc3
-rwxr-xr-x 1 root root 246 2011-08-12 16:11 nctoh5
drwxr-xr-x 11 root root 4096 2011-08-12 16:55 nipy
-rwxr-xr-x 1 root root 199 2011-08-12 16:04 nosetests
-rwxr-xr-x 1 root root 199 2011-08-12 16:04 nosetests-2.7
-rwxr-xr-x 1 root root 181 2011-08-12 16:36 parrec2nii
-rwxr-xr-x 1 root root 2267 2011-08-12 16:05 pilconvert.py
-rwxr-xr-x 1 root root 15319 2011-08-12 16:05 pildriver.py
-rwxr-xr-x 1 root root 2502 2011-08-12 16:05 pilfile.py
-rwxr-xr-x 1 root root 960 2011-08-12 16:05 pilfont.py
-rwxr-xr-x 1 root root 2311 2011-08-12 16:05 pilprint.py
-rwxr-xr-x 1 root root 220 2011-08-12 16:11 ptdump
-rwxr-xr-x 1 root root 222 2011-08-12 16:11 ptrepack
-rwxr-xr-x 1 root root 213 2011-08-12 16:01 pycolor
-rwxr-xr-x 1 root root 207 2011-08-12 16:08 pycrust
-rwxr-xr-x 1 506 506 79 2011-08-12 15:59 pydoc
-rwxr-xr-x 1 root root 216 2011-08-12 16:05 pyflakes
-rwxr-xr-x 1 root root 205 2011-08-12 16:05 pygmentize
-rwxr-xr-x 1 root root 538 2011-08-12 16:11 pyhtmlizer
-rwxr-xr-x 1 root root 207 2011-08-12 16:08 pyshell
-rwxr-xr-x 2 506 506 10374 2011-08-12 15:59 python
-rwxr-xr-x 2 506 506 10374 2011-08-12 15:59 python2.7
-rwxr-xr-x 1 506 506 1619 2011-08-12 15:59 python2.7-config
lrwxrwxrwx 1 506 506 16 2011-07-05 19:46 python-config -> python2.7-config
-rwxr-xr-x 1 root root 206 2011-08-12 16:08 pywrap
-rwxr-xr-x 1 root root 209 2011-08-12 16:08 pywxrc
-rwxr-xr-x 1 1001 users 90834 2011-08-12 16:00 remove-EPD-7.1-2
-rwxr-xr-x 1 root root 597 2011-08-12 16:00 rst2html.py
-rwxr-xr-x 1 root root 794 2011-08-12 16:00 rst2latex.py
-rwxr-xr-x 1 root root 603 2011-08-12 16:00 rst2man.py
-rwxr-xr-x 1 root root 730 2011-08-12 16:00 rst2newlatex.py
-rwxr-xr-x 1 root root 1701 2011-08-12 16:00 rst2odt_prepstyles.py
-rwxr-xr-x 1 root root 767 2011-08-12 16:00 rst2odt.py
-rwxr-xr-x 1 root root 604 2011-08-12 16:00 rst2pseudoxml.py
-rwxr-xr-x 1 root root 640 2011-08-12 16:00 rst2s5.py
-rwxr-xr-x 1 root root 605 2011-08-12 16:00 rst2xml.py
-rwxr-xr-x 1 root root 673 2011-08-12 16:00 rstpep2html.py
-rwxr-xr-x 1 root root 6780 2011-08-12 16:06 scons
-rwxr-xr-x 1 root root 6780 2011-08-12 16:06 scons-2.0.1
-rwxr-xr-x 1 root root 16879 2011-08-12 16:06 sconsign
-rwxr-xr-x 1 root root 16879 2011-08-12 16:06 sconsign-2.0.1
-rwxr-xr-x 1 root root 50487 2011-08-12 16:06 scons-time
-rwxr-xr-x 1 root root 50487 2011-08-12 16:06 scons-time-2.0.1
-rwxr-xr-x 1 506 506 18542 2011-08-12 15:59 smtpd.py
-rwxr-xr-x 1 root root 220 2011-08-12 16:11 sphinx-autogen
-rwxr-xr-x 1 root root 195 2011-08-12 16:11 sphinx-build
-rwxr-xr-x 1 root root 206 2011-08-12 16:11 sphinx-quickstart
-rwxr-xr-x 1 root root 1515029 2011-08-12 16:06 swig
-rwxr-xr-x 1 root root 528 2011-08-12 16:11 tap2deb
-rwxr-xr-x 1 root root 615 2011-08-12 16:11 tap2rpm
-rwxr-xr-x 1 root root 596 2011-08-12 16:11 tapconvert
-rwxr-xr-x 1 root root 534 2011-08-12 16:11 tkconch
-rwxr-xr-x 1 root root 670 2011-08-12 16:11 trial
-rwxr-xr-x 1 root root 208 2011-08-12 16:10 tvtk_doc
-rwxr-xr-x 1 root root 607 2011-08-12 16:11 twistd
-rwxr-xr-x 1 root root 20354 2011-08-12 16:07 vtkEncodeString
-rwxr-xr-x 1 root root 4952419 2011-08-12 16:07 vtkpython
-rwxr-xr-x 1 root root 109429 2011-08-12 16:07 vtkWrapPython
-rwxr-xr-x 1 root root 10356 2011-08-12 16:07 vtkWrapPythonInit
lrwxrwxrwx 1 root root 41 2011-08-12 16:08 wx-config -> ../lib/wx/config/gtk2-unicode-release-2.8
lrwxrwxrwx 1 root root 8 2011-08-12 16:08 wxrc -> wxrc-2.8
-rwxr-xr-x 1 root root 101486 2011-08-12 16:08 wxrc-2.8
-rwxr-xr-x 1 root root 1627 2011-08-12 16:01 xml2-config
-rwxr-xr-x 1 root root 214 2011-08-12 16:08 xrced
-rwxr-xr-x 1 root root 2450 2011-08-12 16:01 xslt-config
答案1
您必须执行其他操作来更改默认 Python 解释器的版本。
该命令ls -l /usr/bin/python
应显示类似以下内容:
lrwxrwxrwx 1 root root 9 2011-05-12 23:59 /usr/bin/python -> python2.7
如果没有指向python2.7
,但python3.2
例如,你将默认的 Python 解释器修改为 3,这不是一个好主意,因为有一些向后不兼容的更改。要恢复 python2.7,你必须运行:
sudo ln -sf python2.7 /usr/bin/python
仅当 /usr/bin/python 实际上是一个符号链接时才执行此操作,如上面的输出所示ls
。