In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces you how to install Python 3 in centos, the content is very detailed, interested friends can refer to it, I hope it can help you.
Python requires some necessary modules before installation, such as openssl, readline, etc. If there are no these modules, there will be some problems later. For example, if there is no openssl, ssl related functions are not supported, and pip3 will directly report errors when installing modules; if there is no readline, the Python interactive interface delete key and the arrow keys cannot be used normally. As for what modules are needed, Python will give a prompt after making, and you can install them by prompt. In addition, thanks to the garden friend Glory_Lion for replying; Here are the dependencies that need to be preloaded in advance:
yum -y install zlib zlib-develyum -y install bzip2 bzip2-develyum -y install ncurses ncurses-develyum -y install readline readline-develyum -y install openssl openssl-develyum -y install openssl-staticyum -y install xz lzma xz-develyum -y install sqlite sqlite-develyum -y install gdbm gdbm-develyum -y install tk tk-devel Install these Python built-in modules are basically complete, and then you can install Python, and these dependencies will be automatically included in the compilation process.
Release file:
tar -xvzf Python-3.5.1.tgz
Enter directory:
cd Python-3.5.1/
Configuration (specify) installation directory (install to/usr/python directory), other options are generally default:
./ configure --prefix=/usr/python
Next compile the source code:
make
Perform installation:
make install
The whole process takes about 5-10 minutes, and after the installation is successful, the installation directory is in/usr/python.
The original python in the system is in/usr/bin/python. As you can see through ls -l, python is a soft link to python 2.7 in this directory.
We can not delete this, do not make any changes to the original default environment, just create a soft link to python3, just need to execute python3 code python to python3, or python script header interpreter to be changed
#!/ usr/bin/python3
The soft links are as follows:
$ ln -s /usr/python/bin/python3 /usr/bin/python3
In this way, you can call python3 directly by executing python3 command in the future. In addition, if you look carefully at the bin directory under the python installation directory, python3 is actually a soft link, linked to python3.5.1. This multiple link is also for the convenience of multiple version management.
Add python to the PATH environment variable of the operating system: Go back to home directory: cdls -al Modify PATH environment variable vi .bash_profile
Reload.bash_profile for changes to take effect
source .bash_profile Re-open a terminal. If the configuration does not take effect, log off the user and it will take effect. How to install Python 3 in centos is shared here. I hope the above content can be of some help to everyone and learn more. If you think the article is good, you can share it so that more people can see it.
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.