No module name apt_pkg

This problem occurred after i forcefully download the python3.7 and replaced the symbolic link of python3 from python3.6 to python3.7.

A cheating method is to run this:
cd /usr/lib/python3/dist-packages,
sudo ln -s apt_pkg.cpython-{36m,37m}-x86_64-linux-gnu.so
I am basically creating a symbolic link apt_pkg.cpython-37m-x86_64-linux-gnu.so from apt_pkg.cpython-36m-x86_64-linux-gnu.so. Because the python3 is pointing to 3.7 it is also looking for the apt_pkg that is 37m.

So as a lesson try not to change the current python3 that is currently running on linux instead compile the python3.7 and do a make altinstall so that you can use python3.7 without affecting the current python3.

For installation of python3.7 on linux I recommend this post.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s