python-dev installation error: ImportError: No module named apt_pkg
Make sure you have a working python-apt package. You could try and remove and install that package again to fix the problem with apt_pkg.so not being located.
apt-get install python-apt
ModuleNotFoundError: No module named 'apt_pkg' installing deadsnakes repository
This worked for me:
sudo apt-get install python3-apt --reinstall
cd /usr/lib/python3/dist-packages
sudo cp apt_pkg.cpython-38-x86_64-linux-gnu.so apt_pkg.so
The 38 in the filename above can be different for you.
Related Topics
Yes' Reporting Error With Subprocess Communicate()
Hex/Binary String Conversion in Swift
How to Dynamically Create Variables
Convert a String Representation of a Dictionary to a Dictionary
Multiprocessing VS Threading Python
Python Regex Find All Overlapping Matches
Fatal Error: Python.H: No Such File or Directory
How to Unescape HTML Entities in a String in Python 3.1
How to Terminate Process from Python Using Pid
Django Server Killed Frequently
How to Make Good Reproducible Pandas Examples
Relative Imports For the Billionth Time