Search code examples
python-3.xvirtualenvubuntu-18.04bzip2

no module named '_bz2' in virtualenv, python3


I'm using 'virtualenv' to manage different environments. (ubuntu 18.04)

But when I workon an env with python3.7 and run the code(smpl-x from github) , it says "no module named '_bz2'".

I tried these:

  1. sudo apt-get install libbz2-dev But it seems that bz2 is not installed in my virualenv, so it doesn't work.

  2. some posts say that I need to rebuild python. But I don't know how to do this in my virtualenv.

Is there a way to solve this problem?

Any help would be greatly appreciated. Thank you very much.


Solution

  • Guys I have solved this problem.

    I removed my global python3.7 and built it again from the source code. Then the problem is solved.

    I'm a noob in linux so not very familiar with these operations.

    Again very appreciate your attention. Thank you very much!!