After building the python3 environment according to the procedure on this page, When I tried to execute the process using scikit-learn, the following error occurred.
ImportError: No module named '_bz2'
After checking, it seems that bzip2-devel is required, so install it below.
$ sudo yum install bzip2-devel
After that, I tried again from "1. Install python3.5" and it worked, so please be careful if you are addicted to the same matter.
Here, install python3.5.1. The usage environment is CentOS 7 of Google Cloud Platform
#download
$ cd /tmp
$ curl -O https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
$ tar zxf Python-3.5.1.tgz
$ cd Python-3.5.1
#Install to the directory specified in prefix
$ ./configure --prefix=/usr/local
$ make
#I installed it with root privileges here, but for private use it is not necessary to add sudo
$ sudo make altinstall
virtualenv itself is already installed (if you don't have it, you can install it with `` `$ pip install virtualenv```)
$ pip freeze | grep virtualenv
virtualenv==15.0.3
Build python3.5 environment
$ cd /usr/share/virtualenv/
#Create
#I installed it with root privileges here, but for private use it is not necessary to add sudo
$ sudo virtualenv -p /usr/local/bin/python3.5 venv35
#activation
$ . venv35/bin/activate
#Verification
$ which python
/usr/share/virtualenv/venv35/bin/python
$ which pip
/usr/share/virtualenv/venv35/bin/pip
Install the required python library according to the purpose and purpose.
#I installed it with root privileges here, but for private use it is not necessary to add sudo
#When running as root, explicitly specify the pip path
$ sudo /usr/share/virtualenv/venv35/bin/pip install \
numpy \
scipy \
sklearn \
gensim \
mecab-python3 \
nltk
Recommended Posts