No module named 'apt_pkg'
时间: 2023-08-25 09:15:53 浏览: 166
Python使用pip安装报错ModuleNotFoundError: No module named ‘pkg_resources’的解决方法
回答: 当使用apt命令时出现ModuleNotFoundError: No module named ‘apt_pkg’错误通常是在升级了Python版本之后导致的。这个错误可以通过在/usr/lib/python3/dist-packages目录下执行以下命令来解决:sudo cp apt_pkg.cpython-35m-x86_64-linux-gnu.so apt_pkg.so。这个命令会将apt_pkg.cpython-35m-x86_64-linux-gnu.so重命名为apt_pkg.so,解决该错误。你可以参考这个链接获取更详细的解决方法:https://super-unix.com/ubuntu/ubuntu-modulenotfounderror-no-module-named-apt_pkg-error/。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [apt update失败,ModuleNotFoundError: No module named ‘apt_pkg](https://blog.csdn.net/StillOnMyWay/article/details/114492675)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [ModuleNotFoundError: No module named ‘apt_pkg](https://blog.csdn.net/HSU0911/article/details/125182688)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文