我在使用 pip 和 pip3 时遇到了这个问题,重新安装它们也没有解决enter code here
hp@hp-desktop:~$ python3.6 -V
Python 3.6.8
hp@hp-desktop:~$ python3 -V
Python 3.5.2
hp@hp-desktop:~$ python -V
Python 2.7.15+
hp@hp-desktop:~$ pip --version
Traceback (most recent call last):
File "/usr/local/bin/pip", line 10, in <module>
sys.exit(main())
TypeError: 'module' object is not callable
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 10, in <module>
sys.exit(main())
TypeError: 'module' object is not callable
hp@hp-desktop:~$ pip3 --version
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 10, in <module>
sys.exit(main())
TypeError: 'module' object is not callable
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 10, in <module>
sys.exit(main())
TypeError: 'module' object is not callable
hp@hp-desktop:~$
hp@hp-desktop:~$ dpkg -L python-pip
/.
/usr
/usr/bin
/usr/bin/pip
/usr/bin/pip2
/usr/lib
/usr/lib/python2.7
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/pip
/usr/lib/python2.7/dist-packages/pip/__init__.py
/usr/lib/python2.7/dist-packages/pip/__main__.py
/usr/lib/python2.7/dist-packages/pip/_vendor
/usr/lib/python2.7/dist-packages/pip/_vendor/__init__.py
/usr/lib/python2.7/dist-packages/pip/basecommand.py
/usr/lib/python2.7/dist-packages/pip/baseparser.py
/usr/lib/python2.7/dist-packages/pip/cmdoptions.py
/usr/lib/python2.7/dist-packages/pip/commands
/usr/lib/python2.7/dist-packages/pip/commands/__init__.py
/usr/lib/python2.7/dist-packages/pip/commands/check.py
/usr/lib/python2.7/dist-packages/pip/commands/completion.py
/usr/lib/python2.7/dist-packages/pip/commands/download.py
/usr/lib/python2.7/dist-packages/pip/commands/freeze.py
/usr/lib/python2.7/dist-packages/pip/commands/hash.py
/usr/lib/python2.7/dist-packages/pip/commands/help.py
/usr/lib/python2.7/dist-packages/pip/commands/install.py
/usr/lib/python2.7/dist-packages/pip/commands/list.py
/usr/lib/python2.7/dist-packages/pip/commands/search.py
/usr/lib/python2.7/dist-packages/pip/commands/show.py
/usr/lib/python2.7/dist-packages/pip/commands/uninstall.py
/usr/lib/python2.7/dist-packages/pip/commands/wheel.py
/usr/lib/python2.7/dist-packages/pip/compat
/usr/lib/python2.7/dist-packages/pip/compat/__init__.py
/usr/lib/python2.7/dist-packages/pip/compat/dictconfig.py
/usr/lib/python2.7/dist-packages/pip/download.py
/usr/lib/python2.7/dist-packages/pip/exceptions.py
/usr/lib/python2.7/dist-packages/pip/index.py
/usr/lib/python2.7/dist-packages/pip/locations.py
/usr/lib/python2.7/dist-packages/pip/models
/usr/lib/python2.7/dist-packages/pip/models/__init__.py
/usr/lib/python2.7/dist-packages/pip/models/index.py
/usr/lib/python2.7/dist-packages/pip/operations
/usr/lib/python2.7/dist-packages/pip/operations/__init__.py
/usr/lib/python2.7/dist-packages/pip/operations/check.py
/usr/lib/python2.7/dist-packages/pip/operations/freeze.py
/usr/lib/python2.7/dist-packages/pip/pep425tags.py
/usr/lib/python2.7/dist-packages/pip/req
/usr/lib/python2.7/dist-packages/pip/req/__init__.py
/usr/lib/python2.7/dist-packages/pip/req/req_file.py
/usr/lib/python2.7/dist-packages/pip/req/req_install.py
/usr/lib/python2.7/dist-packages/pip/req/req_set.py
/usr/lib/python2.7/dist-packages/pip/req/req_uninstall.py
/usr/lib/python2.7/dist-packages/pip/status_codes.py
/usr/lib/python2.7/dist-packages/pip/utils
/usr/lib/python2.7/dist-packages/pip/utils/__init__.py
/usr/lib/python2.7/dist-packages/pip/utils/appdirs.py
/usr/lib/python2.7/dist-packages/pip/utils/build.py
/usr/lib/python2.7/dist-packages/pip/utils/deprecation.py
/usr/lib/python2.7/dist-packages/pip/utils/encoding.py
/usr/lib/python2.7/dist-packages/pip/utils/filesystem.py
/usr/lib/python2.7/dist-packages/pip/utils/glibc.py
/usr/lib/python2.7/dist-packages/pip/utils/hashes.py
/usr/lib/python2.7/dist-packages/pip/utils/logging.py
/usr/lib/python2.7/dist-packages/pip/utils/outdated.py
/usr/lib/python2.7/dist-packages/pip/utils/packaging.py
/usr/lib/python2.7/dist-packages/pip/utils/setuptools_build.py
/usr/lib/python2.7/dist-packages/pip/utils/ui.py
/usr/lib/python2.7/dist-packages/pip/vcs
/usr/lib/python2.7/dist-packages/pip/vcs/__init__.py
/usr/lib/python2.7/dist-packages/pip/vcs/bazaar.py
/usr/lib/python2.7/dist-packages/pip/vcs/git.py
/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py
/usr/lib/python2.7/dist-packages/pip/vcs/subversion.py
/usr/lib/python2.7/dist-packages/pip/wheel.py
/usr/lib/python2.7/dist-packages/pip-9.0.1.egg-info
/usr/lib/python2.7/dist-packages/pip-9.0.1.egg-info/PKG-INFO
/usr/lib/python2.7/dist-packages/pip-9.0.1.egg-info/dependency_links.txt
/usr/lib/python2.7/dist-packages/pip-9.0.1.egg-info/entry_points.txt
/usr/lib/python2.7/dist-packages/pip-9.0.1.egg-info/not-zip-safe
/usr/lib/python2.7/dist-packages/pip-9.0.1.egg-info/requires.txt
/usr/lib/python2.7/dist-packages/pip-9.0.1.egg-info/top_level.txt
/usr/share
/usr/share/doc
/usr/share/doc/python-pip
/usr/share/doc/python-pip/Makefile.gz
/usr/share/doc/python-pip/README.Debian
/usr/share/doc/python-pip/__init__.py
/usr/share/doc/python-pip/conf.py.gz
/usr/share/doc/python-pip/configuration.rst
/usr/share/doc/python-pip/cookbook.rst
/usr/share/doc/python-pip/copyright
/usr/share/doc/python-pip/development.rst.gz
/usr/share/doc/python-pip/index.rst
/usr/share/doc/python-pip/installing.rst
/usr/share/doc/python-pip/logic.rst
/usr/share/doc/python-pip/make.bat.gz
/usr/share/doc/python-pip/news.rst
/usr/share/doc/python-pip/pipext.py
/usr/share/doc/python-pip/quickstart.rst
/usr/share/doc/python-pip/reference
/usr/share/doc/python-pip/reference/index.rst
/usr/share/doc/python-pip/reference/pip.rst.gz
/usr/share/doc/python-pip/reference/pip_download.rst
/usr/share/doc/python-pip/reference/pip_freeze.rst
/usr/share/doc/python-pip/reference/pip_hash.rst
/usr/share/doc/python-pip/reference/pip_install.rst.gz
/usr/share/doc/python-pip/reference/pip_list.rst
/usr/share/doc/python-pip/reference/pip_search.rst
/usr/share/doc/python-pip/reference/pip_show.rst
/usr/share/doc/python-pip/reference/pip_uninstall.rst
/usr/share/doc/python-pip/reference/pip_wheel.rst
/usr/share/doc/python-pip/usage.rst
/usr/share/doc/python-pip/user_guide.rst.gz
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/pip.1.gz
/usr/share/doc/python-pip/changelog.Debian.gz
/usr/share/man/man1/pip2.1.gz
hp@hp-desktop:~$ dpkg -L python3-pip
/.
/usr
/usr/bin
/usr/bin/pip3
/usr/lib
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/pip
/usr/lib/python3/dist-packages/pip/__init__.py
/usr/lib/python3/dist-packages/pip/__main__.py
/usr/lib/python3/dist-packages/pip/_vendor
/usr/lib/python3/dist-packages/pip/_vendor/__init__.py
/usr/lib/python3/dist-packages/pip/basecommand.py
/usr/lib/python3/dist-packages/pip/baseparser.py
/usr/lib/python3/dist-packages/pip/cmdoptions.py
/usr/lib/python3/dist-packages/pip/commands
/usr/lib/python3/dist-packages/pip/commands/__init__.py
/usr/lib/python3/dist-packages/pip/commands/check.py
/usr/lib/python3/dist-packages/pip/commands/completion.py
/usr/lib/python3/dist-packages/pip/commands/download.py
/usr/lib/python3/dist-packages/pip/commands/freeze.py
/usr/lib/python3/dist-packages/pip/commands/hash.py
/usr/lib/python3/dist-packages/pip/commands/help.py
/usr/lib/python3/dist-packages/pip/commands/install.py
/usr/lib/python3/dist-packages/pip/commands/list.py
/usr/lib/python3/dist-packages/pip/commands/search.py
/usr/lib/python3/dist-packages/pip/commands/show.py
/usr/lib/python3/dist-packages/pip/commands/uninstall.py
/usr/lib/python3/dist-packages/pip/commands/wheel.py
/usr/lib/python3/dist-packages/pip/compat
/usr/lib/python3/dist-packages/pip/compat/__init__.py
/usr/lib/python3/dist-packages/pip/compat/dictconfig.py
/usr/lib/python3/dist-packages/pip/download.py
/usr/lib/python3/dist-packages/pip/exceptions.py
/usr/lib/python3/dist-packages/pip/index.py
/usr/lib/python3/dist-packages/pip/locations.py
/usr/lib/python3/dist-packages/pip/models
/usr/lib/python3/dist-packages/pip/models/__init__.py
/usr/lib/python3/dist-packages/pip/models/index.py
/usr/lib/python3/dist-packages/pip/operations
/usr/lib/python3/dist-packages/pip/operations/__init__.py
/usr/lib/python3/dist-packages/pip/operations/check.py
/usr/lib/python3/dist-packages/pip/operations/freeze.py
/usr/lib/python3/dist-packages/pip/pep425tags.py
/usr/lib/python3/dist-packages/pip/req
/usr/lib/python3/dist-packages/pip/req/__init__.py
/usr/lib/python3/dist-packages/pip/req/req_file.py
/usr/lib/python3/dist-packages/pip/req/req_install.py
/usr/lib/python3/dist-packages/pip/req/req_set.py
/usr/lib/python3/dist-packages/pip/req/req_uninstall.py
/usr/lib/python3/dist-packages/pip/status_codes.py
/usr/lib/python3/dist-packages/pip/utils
/usr/lib/python3/dist-packages/pip/utils/__init__.py
/usr/lib/python3/dist-packages/pip/utils/appdirs.py
/usr/lib/python3/dist-packages/pip/utils/build.py
/usr/lib/python3/dist-packages/pip/utils/deprecation.py
/usr/lib/python3/dist-packages/pip/utils/encoding.py
/usr/lib/python3/dist-packages/pip/utils/filesystem.py
/usr/lib/python3/dist-packages/pip/utils/glibc.py
/usr/lib/python3/dist-packages/pip/utils/hashes.py
/usr/lib/python3/dist-packages/pip/utils/logging.py
/usr/lib/python3/dist-packages/pip/utils/outdated.py
/usr/lib/python3/dist-packages/pip/utils/packaging.py
/usr/lib/python3/dist-packages/pip/utils/setuptools_build.py
/usr/lib/python3/dist-packages/pip/utils/ui.py
/usr/lib/python3/dist-packages/pip/vcs
/usr/lib/python3/dist-packages/pip/vcs/__init__.py
/usr/lib/python3/dist-packages/pip/vcs/bazaar.py
/usr/lib/python3/dist-packages/pip/vcs/git.py
/usr/lib/python3/dist-packages/pip/vcs/mercurial.py
/usr/lib/python3/dist-packages/pip/vcs/subversion.py
/usr/lib/python3/dist-packages/pip/wheel.py
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/PKG-INFO
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/dependency_links.txt
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/entry_points.txt
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/not-zip-safe
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/requires.txt
/usr/lib/python3/dist-packages/pip-9.0.1.egg-info/top_level.txt
/usr/share
/usr/share/doc
/usr/share/doc/python3-pip
/usr/share/doc/python3-pip/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/pip3.1.gz
/usr/share/doc/python3-pip/changelog.Debian.gz
编辑
你能帮忙解决这个问题吗?
Configurazione di update-notifier-common (3.192.1.7)...
Traceback (most recent call last):
File "/usr/lib/update-notifier/package-data-downloader", line 24, in <module>
import debian.deb822
ImportError: No module named 'debian'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ImportError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/lib/update-notifier/package-data-downloader", line 24, in <module>
import debian.deb822
ImportError: No module named 'debian'
dpkg: errore nell'elaborare il pacchetto update-notifier-common (--configure):
il sottoprocesso installato pacchetto update-notifier-common script post-installation ha restituito lo stato di errore 1
dpkg: problemi con le dipendenze impediscono la configurazione di update-notifier:
update-notifier dipende da update-notifier-common (= 3.192.1.7); tuttavia:
Il pacchetto update-notifier-common non è ancora configurato.
dpkg: errore nell'elaborare il pacchetto update-notifier (--configure):
problemi con le dipendenze - lasciato non configurato
dpkg: problemi con le dipendenze impediscono la configurazione di update-manager:
update-manager dipende da update-notifier; tuttavia:
Il pacchetto update-notifier non è ancora configurato.
dpkg: errore nell'elaborare il pacchetto update-manager (--configure):
problemi con le dipendenze - lasciato non configurato
Configurazione di python-apt (1.6.4)...
Segnalazione apport non scritta poiché il messaggio di errore indica la presenza di un fallimento precedente.
Segnalazione apport non scritta poiché il messaggio di errore indica la presenza di un fallimento precedente.
Si sono verificati degli errori nell'elaborazione:
update-notifier-common
update-notifier
update-manager
E: Sub-process /usr/bin/dpkg returned an error code (1)
`
答案1
我觉得好像apt_pkg
缺少模块。您可以尝试使用以下命令重新安装它们:
$ sudo apt update
$ sudo apt install python3-apt python-apt --reinstall
如果这没有帮助,请尝试完全清除 python 并使用以下命令重新安装它:
$ sudo apt purge "python*" "python3*"
$ sudo apt install python python3 python-pip python3-pip
确保重新安装您可能需要的任何其他模块。