In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How to upgrade Python and Mongodb drivers in Centos? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
What does python mean Python is a cross-platform, interpretive, compiled, interactive and object-oriented scripting language, originally designed to write automated scripts, and is often used to develop independent and large-scale projects as versions are constantly updated and new features are added.
First go to the official website to download the python package you want, and then decompress it. Enter the home directory to do the following (GCC compiler is required)
. / configure-- prefix=/usr/localmake all make install make clean make distclean
After executing these commands, you can see python2.7 in the / usr/local/bin/ directory, and then try to execute / usr/local/bin/python2.7-V if the version number indicates that the installation is successful. But the upgrade is only halfway through, you can run python-V on the terminal again and you will find that it is still the version number before the upgrade. Do the following at this time.
Establish a soft connection so that the default python of the system points to python2.7
Mv / usr/bin/python / usr/bin/python2.6.6 ln-s / usr/local/bin/python2.7 / usr/bin/python
At this time you are running python-V and it will be the version you installed.
The version of python has been upgraded, but you are still a few steps away from it.
At this point you can try to execute yum list on the terminal and you will find that the yum instruction is not available because yum is not compatible with python 2.7by default.
We need to modify the / usr/bin/yum file to open it with vim (administrator privileges are required).
The header of the file
! / usr/bin/python
Change to
! / usr/bin/python2.6.6 this is the file you modified the link before.
In this way, the python upgrade work is almost complete.
Install the MongoDb driver
After installing python, we use it. Python sometimes needs a lot of third-party libraries. These libraries need to be installed in addition. The main installation tools are setuptools and pip (I won't talk about the difference between these two tools here).
Here's how to install setuptools and MongoDb drivers offline on the server (our server is firmly forbidden to go on the extranet, not even for a second).
Install setuptools
Download setuptools-1.4.2.tar.gz
After decompressing, go to the home directory and execute python setup.py install
If the installation process prompts you that the appropriate py package is missing, install the appropriate package through yum (below)
Then recompile and install py, and the installation will be successful after continuing.
Note that the following packages are generally missing
Yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel
After installing setuptools, you can install the driver for mongodb.
After reading the above, have you mastered how to upgrade Python and Mongodb drivers in Centos? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.