No module named ‘_bz2‘

[Problem]
mmlab failed to load using custom_imports, and an error occurred when debugging and discovering the import:
ModuleNotFoundError: No module named '_bz2'
Insert image description here

[Solution]
Refer to the answer at the end of https://stackoverflow.com/questions/50335503/no-module-named-bz2-in-python3 .
Insert image description here

  1. Download file:
    https://github.com/nuaalyh/Note/blob/master/python/_bz2.cpython-38-x86_64-linux-gnu.so
  2. Place the file in the relevant path
    cp _bz2.cpython-38-x86_64-linux-gnu.so  /usr/local/python3/lib/python3.9/lib-dynload/
    
  3. Modify file permissions
    chmod +x _bz2.cpython-38-x86_64-linux-gnu.so
    

[Appendix]
If you encounter the problem ModuleNotFoundError: No module named '_lzma' later, you can check:
https://blog.csdn.net/qq_39735236/article/details/130954074?spm=1001.2014.3001.5502

Guess you like

Origin blog.csdn.net/qq_39735236/article/details/131937498