In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "how to install Python3.7 on CentOS7" related knowledge, editor through the actual case to show you the operation process, the method of operation is simple and fast, practical, I hope that this "how to install Python3.7 on CentOS7" article can help you solve the problem.
Get the source code
Download the required source code version at the Python official website
Curl-O https://www.python.org/ftp/python/3.7.13/Python-3.7.13.tgz preparation (installation dependency)
In fact, relying on not installing all can also be compiled smoothly, but some components such as compression algorithm and ssl,tk will be abandoned in the make phase, but it is recommended to install them if possible.
Yum install-y gcc makeyum install-y openssl openssl-devel openssl-static bzip2 bzip2-devel ncurses ncurses-devel readline readline-devel xz lzma xz-devel sqlite sqlite-devel gdbm gdbm-devel expat-devel tk tk-devel tcl tcl-devel libffi libffi-devel generates Makefile
Here, we mainly pay attention to the following parameters,-- enable-shared generates dynamic dependent libraries (unnecessary),-- prefix specifies the Python installation directory (be sure to specify, especially when there are multiple python environments, you do not want to overwrite the Python that comes with the system and cause system components such as yum to die),-- enable-optimizations (optimization parameters are not necessary). Also, if your openssl is installed in another directory or in a multi-openssl environment, use-- with-openssl=DIR to specify the version of openssl you use, which is very important when building a higher version of python on a lower version of the operating system. For example, centos7 does not have enough openssl-1.0.2 to build Python3.10 (python3.10 requires openssl 1.1.1 or above) But hasty revision of the openssl version of the system will cause the rest of the dependent programs to crash, so you can only install openssl in a specific directory and use it.
# decompress the source package tar zxvf Python-3.7.13.tgz & & cd Python-3.7.13# to generate Makefile./configure-- enable-shared-- prefix=/usr/local/python3.7-- enable-optimizations build & & install
It is said that it is really slow to compile on Kunpeng cpu, which has a low main frequency.
Make & & make install add environment variable echo 'export PATH= "$PATH:/usr/local/python3.7.3/bin" > / etc/profile other minor problems cannot find libpython 3.7m.so.1.0 [root @ localhost Python-3.7.13] # python3python3: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
Put the libpython3.7m.so.1.0 where the system can find it.
# small pits on cp-f libpython3.7m.so.1.0 / lib64 upgrade pip in the compiled directory
If you want to ensure that you upgrade pip in a multi-python environment (where python2 and python3 co-exist), it is recommended to use the
Curl https://bootstrap.pypa.io/get-pip.py | python3
To upgrade, it has been guaranteed that the upgrade process will not mistakenly call python2
Factors affecting the portability of python programs after pyinstaller Packaging
Apart from the architecture of cpu and the number of bits of the operating system (which are too easy to notice), I refer to the glib version. If your compilation environment has the behavior of upgrading the kernel so that the glibc version has been changed, the higher version of the packaged program cannot run on the lower version of the glibc system (and vice versa). So if you want the packaged program to run on as many operating systems as possible, please build your program on a lower version of glibc. Here is a suggested combination of centos5.8+python3.6.1, which should be a more extreme combination, glibc version 2.5. What do you think? Ldd-- version will be fine.
This is the end of the introduction on "how to install Python3.7 on CentOS7". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.