0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ModuleNotFoundError: No module named 'apt_pkg'が発生したら、pythonパッケージのバージョンを疑え

Posted at

・タイトルは一例です

環境

・Ubuntu20.04

エラー内容

zombie@DESKTOP-JLU30CD:~$ yarn install
Traceback (most recent call last):
  File "/usr/lib/command-not-found", line 28, in <module>
    from CommandNotFound import CommandNotFound
  File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
    from CommandNotFound.db.db import SqliteDatabase
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
zombie@DESKTOP-JLU30CD:~$

解決法

こちらの記事より、おそらくpythonのバージョンが影響していることが問題の原因なのかなと推察
・私自身の過去の投稿より、pythonのバージョンを上げたことによる影響も考えた↓
https://qiita.com/Zombie_PG/items/62f4b792ac541c04ee40
・んで解法↓

zombie@DESKTOP-JLU30CD:~$ sudo ln -sf /usr/bin/python3.8 /usr/bin/python3

再実行

zombie@DESKTOP-JLU30CD:~$ yarn install

Command 'yarn' not found, but can be installed with:

sudo apt install cmdtest

zombie@DESKTOP-JLU30CD:~$

ひとまず成功。

参考記事

ModuleNotFoundError: No module named 'apt_pkg'

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?