Build a python3 environment on CentOS7

0. In advance

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.

1. Install python3.5

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

2. Build a python3.5 environment using virtualenv

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

3. Install the library you want to use

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

Build a python3 environment on CentOS7
Build a python environment with ansible on centos6
Create a python environment on centos
Build a Python + OpenCV environment on Cloud9
Build a python environment on CentOS 7.7 for your home server
Build a LAMP environment [CentOS 7]
Build Python environment on Windows
Build a Python environment offline
Simply build a Python 3 execution environment on Windows
Build a Python development environment on your Mac
Build a Python development environment on Raspberry Pi
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Building a Python environment on Ubuntu
Create a Python environment on Mac (2017/4)
Build a machine learning Python environment on Mac OS
Build a GVim-based Python development environment on Windows 10 (1) Installation
How to build a Django (python) environment on docker
Build a Python development environment on Mac OS X
Set up Python environment on CentOS
Build a Python environment on your Mac using pyenv
Build a Python development environment using pyenv on MacOS
Build Python 3.8 + Pipenv environment on Ubuntu 18.04
How to build a Python environment on amazon linux 2
Build a python machine learning study environment on macOS sierra
How to build a new python virtual environment on Ubuntu
Build a python data analysis environment on Mac (El Capitan)
Build a GVim-based Python development environment on Windows 10 (2) Basic settings
Python 2.7, 3.4, 3.5 extension module build environment on Windows
Create a python environment on your Mac
A memo with Python2.7 and Python3 on CentOS
I want to build a Python environment
Creating a python virtual environment on Windows
Build Python environment with Anaconda on Mac
Build WordPress on CentOS 8 in LAMP environment
Build a python virtual environment with pyenv
Build a modern Python environment with Neovim
Install Python3.4 on CentOS 6.6
Install Python 2.7.3 on CentOS 5.4
build Python on Ubuntu
Create a Python environment
Build a 64-bit Python 2.7 environment with TDM-GCC and MinGW-w64 on Windows 7
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
Stray build Python-3.8.5 on CentOS without root privileges
Build a LAMP environment on your local Docker
Build a WardPress environment on AWS with pulumi
Build python environment with pyenv on EC2 (ubuntu)
Build Python3.5 + matplotlib environment on Ubuntu 12 using Anaconda
Build a Django environment on Raspberry Pi (MySQL)
[Python] Build a Django development environment with Docker
Create a python3 build environment with Sublime Text3
Build a simple Python virtual environment without pyenv
[Venv] Create a python virtual environment on Ubuntu
Build Python3 + flask environment on GCP Compute Engine
Build a Kubernetes environment for development on Ubuntu
Set up a Python development environment on Marvericks
Build a Python environment with OSX El capitan
Quickly build a Python Django environment with IntelliJ
Building a Python environment on a Sakura VPS server
Create a Python execution environment on IBM i
Create a Python virtual development environment on Windows
Build a Python machine learning environment with a container