{"id":1257,"date":"2022-10-26T14:07:00","date_gmt":"2022-10-26T12:07:00","guid":{"rendered":"https:\/\/ndk.sytes.net\/wordpress\/?p=1257"},"modified":"2023-02-06T10:56:56","modified_gmt":"2023-02-06T09:56:56","slug":"install-python-3-7-on-centos-7","status":"publish","type":"post","link":"https:\/\/ndk.sytes.net\/wordpress\/?p=1257","title":{"rendered":"Install Python 3.7+ on CentOS 7"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Step 1: Install requirements<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"># yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Download python<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"># <code>cd \/usr\/src<\/code>\n# <code>wget https:\/\/www.python.org\/ftp\/python\/3.7.15\/Python-3.7.15.tgz<\/code><\/pre>\n\n\n\n<p>Feel free to replace -3.7.15 by any version available<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Configuring and installing<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># tar -xzf Python-3.7.15.tgz\n# cd Python-3.7.15\n# .\/configure --enable-optimizations --enable-shared\n# make altinstall<\/code><\/pre>\n\n\n\n<p><em>&#8211;enable-shared<\/em> installs shared libraries instead of building into python. This enables some 3rd party modules to install and load (e.g. mod_wsgi)<br><em>make altinstall<\/em> installs python as an alternative to the OS version, thus leaving the installed version untouched<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Post installation<\/h2>\n\n\n\n<p>To activate python on your system, add the path to \/etc\/ld.so.conf and run ldconfig (only needed the first time):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># echo \"\/usr\/local\/lib\" >> \/etc\/ld.so.conf<br># ldconfig<\/code><\/pre>\n\n\n\n<p>or simply run this commnand (this does not survive ldconfig reloads or system reboots):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># ldconfig \/usr\/local\/lib<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Step 1: Install requirements # yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel xz-devel Step 2: Download python # cd \/usr\/src # wget https:\/\/www.python.org\/ftp\/python\/3.7.15\/Python-3.7.15.tgz Feel free to replace -3.7.15 by any version available Step 3: Configuring and installing &#8211;enable-shared installs shared libraries instead of building into python. This enables some 3rd party modules to install and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1257","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1257"}],"version-history":[{"count":4,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1257\/revisions"}],"predecessor-version":[{"id":1266,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1257\/revisions\/1266"}],"wp:attachment":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}