In python3.6
, when executing the following command:
from sklearn.model_selection import GridSearchCV
Reported Error:
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
However, issue is that I don't have root access to machine to use the solutions posted on the same issue on stackoverflow.
On trying to locate libbz2.so
, I received following:
/usr/lib64/libbz2.so.1
/usr/lib64/libbz2.so.1.0.6
To be noted: in my bash_profile
the LIBRARY_PATH
did not have '/usr/lib64' explicitly specified when I compiled python3.6
from source.
bz2
is an optional dependency of python, but sklearn
assumes your python installation has this module .
There are at least two possible ways to fix this:
bz2
optional . ( Thanks to sascha for pointing this out.) libbz2
and then re-build python3.6.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.