Python 3 reported an error: modulenotfounderror: no module named ‘_ bz2’
system information
System: Ubuntu 1804 lts
Python version: Python 3.7
Error message
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
Solution:
1. installation
sudo apt install bzip2-devel
2. Find the file _bz2.cpython-37m-x86_64-linux-gnu.so
3. Modify the file name
If your python version is 3.6, it is 36m, mine is python3.7, you have to change the file name to 37m, and copy it to the python3 installation directory
mv _bz2.cpython-36m-x86_64-linux-gnu.so _bz2.cpython-37m-x86_64-linux-gnu.so
cp _bz2.cpython-37m-x86_64-linux-gnu.so /usr/local/python3/lib/python3.7/lib-dynload/
Similar Posts:
- Ubuntu Error: No module named ‘apt_pkg’ (Step-by-Step Tutorial)
- Bpython ImportError: No module named _curses [How to Solve]
- [Solved] Centos6: Python 2.6 upgrade to 3.7, error handling [no module named ‘_ctypes’]
- git bash bash: *: command not found
- How to Solve Centos Yum Error: No module named yum
- modulenotfounderror: no module named ‘cv2’ [How to Solve]
- Python Installation WARNING: pip is configured with locations that require TLS/SSL, however the ssl module…
- Module not found error: wrong solution of no module named ‘windows’ and no module named’ win32API ‘
- Error “modulenotfounderror: no module named” in installing flash in Python 3.8_ ctypes’”
- Make Command ERROR: “make:*** No targets specified and no makefile found.Stop.” [Three Method to Solve]