Centos Python Installation Guide with no Pain

Centos 7 + Python 3(4,5,6,7,8) installation guide with no pain. As for me.

I can’t even say how many times I have to update my python executables for web servers and how much pain I feel during this routine.

Usual Google\StackOverflow advice only describes one particular problem. But there’re few of them, and they’re different so you spent hours trying to collect them all and pick the right decision.

Then you just drop it and use yum for any latest python version available!

Here I’ll show you and make a reminder for myself about how to install modern python in the best way, once, without pain.

I use Centos 7 typical install as for WebServer (minimal install could require to install tonnes of dev-libs and yum, be sure you prepared them before)

1. Preparations:

You need to install some compil libs.

2. Download Python:

3. Configure and install:

Explanation: proof

  • –prefix – a usual place of an interpreter to install.
  • –enable-optimizations – python runs faster (proof)
  • –enable-shared allow use shared libs (proof)
  • LDFLAGS=”-Wl,-rpath /usr/local/lib” – most important – install system variable to locate .so modules for new python.
  • make altinstall – install without interruption of the system python

Errors you may see when LD path do not set or used incorrectly:

Extra steps to fix it:

  • Check reference cat /etc/ld.so.conf – should load “* so.conf.d”
  • vi /etc/ld.so.conf.d/libpython3.8.conf
    • Add: /usr/local/lib/
    • Add: /usr/local/lib/libpython3.8.so.1.0
  • /sbin/ldconfig -v – to load them all (-v for visible mode)

You could also try this:

How about pip and python3 from cmd:

Just adding symlinks to easy use of python3 and pip3:
(do not overlap with python2.7)

Defaults:

That’s all folks!

Next: How to mod_wsgi + Django + Celery and so on.

trianglesis

About trianglesis

Александр Брюндтзвельт - гений, филантроп, 100 гривен в кармане. Этот блог - "сток" моих мыслей и заметок. Достаточно одного взгляда на него, чтобы понять, что такой же бардак творится у меня в голове. Если вам этот бардак интересен - милости прошу.
Bookmark the permalink.

Comments are closed.