[CENTOS] Building a Python environment on a Sakura VPS server

environment

CentOS release 6.8

What to install

Caution

CentOS yum seems to work only with the pre-installed version of Python. So, if you install the latest version of Python, your system may break, so you shouldn't do it. Therefore, it seems to use the trick of installing Python under / usr / local. The procedure for squid is described in How to install the latest version of Python on CentOS. The procedure remains the same.

procedure

I heard that I have to download development tools

# Compilers and related tools:
yum groupinstall -y "development tools"
# Libraries needed during compilation to enable all features of Python:
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel expat-devel
# If you are on a clean "minimal" install of CentOS you also need the wget tool:
yum install -y wget

Then wget the source code for Python 2 and 3 and compile it

# Python 2.7.13:
wget http://python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz
tar xf Python-2.7.13.tar.xz
cd Python-2.7.13
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

# Python 3.6.0:
wget http://python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
tar xf Python-3.6.0.tar.xz
cd Python-3.6.0
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall

I don't know what you're doing, but I've done this for the time being

strip /usr/local/lib/libpython2.7.so.1.0
strip /usr/local/lib/libpython3.6m.so.1.0

Next is the installation of pip, but there seems to be a Python script for that, wget it and execute it.

# First get the script:
wget https://bootstrap.pypa.io/get-pip.py

# Then execute it using Python 2.7 and/or Python 3.6:
python2.7 get-pip.py
python3.6 get-pip.py

Now you can use pip install! Yay!

Recommended Posts

Building a Python environment on a Sakura VPS server
Building a Python environment on Mac
Building a Python environment on Ubuntu
Building a Python virtual environment
Building a Python virtual environment
Procedure for building a CDK environment on Windows (Python)
Install Python3 on Sakura server (FreeBSD)
Create a Python environment on Mac (2017/4)
Building a virtual environment with Python 3
Create a python environment on centos
Build a python3 environment on CentOS7
Building a Python environment on a Mac and using Jupyter lab
Until building a Python development environment using pyenv on Ubuntu 20.04
Build a python environment on CentOS 7.7 for your home server
[Pyenv] Building a python environment with ubuntu 16.04
Building a Python3 environment with Amazon Linux2
Build a python environment on MacOS (Catallina)
Create a python environment on your Mac
Building a Python 3.6 environment with Windows + PowerShell
Build a Python + OpenCV environment on Cloud9
Building a Python development environment for AI development
Everything from building a Python environment to running it on Windows
Simply build a Python 3 execution environment on Windows
Build a python environment with ansible on centos6
Building a Python environment with WLS2 + Anaconda + PyCharm
Build a Python environment on Mac (Mountain Lion)
Build a Python development environment on your Mac
[Python] Web development preparation (building a virtual environment)
Think about building a Python 3 environment in a Mac environment
[Venv] Create a python virtual environment on Ubuntu
Set up a Python development environment on Marvericks
Create a Python environment
Create a Python execution environment on IBM i
Building a machine learning environment with Tellus GPU server (Sakura high-power computing)
Create a Python virtual development environment on Windows
Build a Python development environment on Raspberry Pi
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Write about building a Python environment for writing Qiita Qiita
Recommendation of building a portable Python environment with conda
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
Building a Docker working environment for R and Python
Build a machine learning Python environment on Mac OS
Notes on creating a python development environment on macOS Catalina
Building a TensorFlow environment that uses GPU on Windows 10
I made a Python3 environment on Ubuntu with direnv.
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
Build a Python development environment using pyenv on MacOS
conda memorandum: Building a Python environment with supercomputer ITO
Create a decent shell and python environment on Windows
Memo for building a machine learning environment using Python
How to build a Python environment on amazon linux 2
Create a Python development environment on OS X Lion
Build Python environment on Windows
Build python environment on windows
Build a Python environment offline
Build a python machine learning study environment on macOS sierra
How to build a new python virtual environment on Ubuntu
Let's get started with Python ~ Building an environment on Windows 10 ~
Building a python environment for artificial intelligence (Chainer / TensorFlow / CSLAIER)