This issue tracker has been migrated to GitHub , and is currently read-only .
For more information, see the GitHub FAQs in the Python's Developer Guide.

Module bz2 fails to be imported on Ubuntu due to lack of '_bz2'.  We try "import bz2" on Mac, it can work well.
Errors on Ubuntu
==========================================
>>import bz2
Traceback (most recent call last):
      File "/home/xxm/Desktop/apifuzz/doc/genDoc.py", line 97, in <module>
           exec(compile(mstr,'','exec'))
      File "", line 1, in <module>
           File "/home/xxm/Desktop/apifuzz/Python-3.9.2/Lib/bz2.py", line 18, in <module>
                from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
===========================================
Python version: 3.9.2
Python installation: (1). download source code from python.org, (2). run command "./configure; sudo make; sudo make install.
We install the same Python 3.9.2 in a same way on Mac and Ubuntu.
You're probably missing needed dependencies. For example, see https://stackoverflow.com/questions/12806122/missing-python-bz2-module
If you look at the output of make, you should be able to see that _bz2 wasn't built.
You are likely did not have headers for bz2 library installed. Read thoughtfully the output of ./configure and make.
See also https://devguide.python.org/setup/#install-dependencies .
2022-04-11 14:59:42adminsetgithub: 87637 2021-03-17 17:15:29eric.smithsetstatus: open -> closed
resolution: not a bug
messages: + msg388941

stage: resolved 2021-03-12 10:21:36serhiy.storchakasetstatus: pending -> open
nosy: + serhiy.storchaka
messages: + msg388537

2021-03-12 00:00:27eric.smithsetstatus: open -> pending 2021-03-11 07:36:23eric.smithsetnosy: + eric.smith
messages: + msg388484
2021-03-11 07:20:37xxmcreate