码迷,mamicode.com
首页 > 编程语言 > 详细

更换python版本后出现 No module named "apt_pkg"

时间:2019-11-10 22:37:02      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:terminal   rac   module   原来   erro   rom   快捷键   like   col   

本文链接:https://blog.csdn.net/jaket5219999/article/details/78464310

$ sudo apt-get remove --purge python-apt
$ sudo apt-get install python-apt -f
$ sudo find / -name "apt_pkg.cpython-35m-x86_64-linux-gnu.so"
$ cd /usr/lib/python3/dist-packages/
$ sudo cp apt_pkg.cpython-35m-x86_64-linux-gnu.so apt_pkg.cpython-36m-x86_64-linux-gnu.so

背景:
系统: ubuntu17

python版本: 默认版本原来是python2.7,  先装了python3.5=python3.5.3 , 后又装了python3.6=python3.6.1

将默认版本改为python3.6后就出现No module named "apt_pkg"的问题了:

本来Ctrl+Alt+T是打开终端的快捷键, 突然用不了, 去到键盘里面的快捷键设置看到命令还是`gnome-terminal`

打开一个终端, 运行`gnome-terminal`就出现如下错误了:

...

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
ModuleNotFoundError: No module named ‘apt_pkg‘

...

更换python版本后出现 No module named "apt_pkg"

标签:terminal   rac   module   原来   erro   rom   快捷键   like   col   

原文地址:https://www.cnblogs.com/Ph-one/p/11832017.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!