In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Compile and install Python3
Start by installing some dependent packages that are required for compilation through yum:
[root@localhost ~] # yum install-y wget gcc make libffi-devel zlib*
Go to the Python official website to download the address:
Https://www.python.org/downloads/source/
What I choose here is the latest version 3.8.0:
Clicking the appropriate version will jump to the download page of that version, scroll to the bottom of the page, and copy the source code download link:
Then go to Linux and use the wget command to download, and use the tar command to extract the downloaded source package:
[root@localhost ~] # cd / usr/local/src [root@localhost / usr/local/src] # wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz[root@localhost / usr/local/src] # tar-zxvf Python-3.8.0.tgz
Enter the extracted directory and follow these steps to complete the compilation and installation:
[root@localhost / usr/local/src] # cd Python-3.8.0 [root@localhost / usr/local/src/Python-3.8.0] #. / configure-- prefix=/usr/local/python [root@localhost / usr/local/src/Python-3.8.0] # make & & make install
After the installation is complete, you need to configure the system environment variables to use the commands of Python:
[root@localhost ~] # vim / etc/profilePYTHON_HOME=/usr/local/pythonexport PATH=$PATH:$PYTHON_HOME/ [root @ localhost ~] # source / etc/profile
Finally verify the version:
[root@localhost / usr/local/src/Python-3.8.0] # pip3-versionpip 19.3.1 from / usr/local/python/lib/python3.8/site-packages/pip (python3.8) [root@localhost / usr/local/src/Python-3.8.0] # python3Python 3.8.0 (default, Nov 20 2019, 09:27:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] on linuxType "help", "copyright" "credits" or "license" for more information. > > exit () [root@localhost / usr/local/src/Python-3.8.0] # install ansible through pip3
In CentOS7, you can install ansible directly through yum. However, the installation package for ansible is no longer available under the default yum source of CentOS8. Instead, you need to install it through the pip command of Python, which is why you need to install Python first.
We need to change the source of ansible before installing pip. Here, take the source of Douban as an example. First, execute the following command to install the Douban source:
[root@localhost] # pip3 install xlrd-I http://pypi.douban.com/simple-- trusted-host pypi.douban.com
Then create a new pip configuration file under the user's home directory, as follows:
[root@localhost ~] # mkdir ~ / .pip # the directory where the newly created configuration files are stored [root@localhost ~] # vim ~ / .pip/pip.conf # configuration download source [global] index-url = http://pypi.douban.com/simple[install]trusted-host = pypi.douban.com [root@localhost ~] #
After you have replaced the download source, you can begin to install ansible. The installation commands are as follows:
[root@localhost ~] # pip3 install ansible
Finally, verify that the installation was successful:
[root@localhost ~] # ansible-- versionansible 2.9.1 config file = None configured module search path = ['/ root/.ansible/plugins/modules','/ usr/share/ansible/plugins/modules'] ansible python module location = / usr/local/python/lib/python3.8/site-packages/ansible executable location = / usr/local/python/bin/ansible python version = 3.8.0 (default, Nov 20 2019 09:27:22) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)] [root@localhost ~] #
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.