Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to upgrade Python and Mongodb drivers in Centos

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to upgrade Python and Mongodb drivers in Centos". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

What does python mean?

Python is a cross-platform, interpretable, compilable, interactive, object-oriented scripting language. It was originally designed to write automated scripts. As versions are constantly updated and new features are added, they are often used to develop stand-alone and large-scale projects.

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 (supported by the GCC compiler). / configure-prefix=/usr/local

Makeall

Installation

Make clean

After executing these commands, Makedistclean 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 is displayed, the installation has been successful. However, the upgrade is only halfway through. Python-V can be executed on the terminal again, and the version number will be found before upgrading. At this point, do the following.

Establish a soft connection so that the system default python points to python2.7

Mv/usr/bin/python/usr/bin/python 2. 6. six

Ln-s/usr/local/bin/python 2.7/usr/bin/python when you run python-V, it will be the version you installed.

The version of Python has been upgraded, but you are still a few steps away.

At this point, you can try to execute the yum list on the terminal, and you will find that the yum instruction cannot be used because yum is not compatible with python 2.7 by default.

We need to modify the / usr/bin/yum file and open it with vim (administrator privileges are required).

Set the header of the

! / usr/bin/python

Change

! / usr/bin/python2.6.6 this is the file that you modified the link before

In this way, the python upgrade is almost complete.

Install the MongoDb driver

After you install python, you are ready to use it. Python sometimes requires a lot of third-party libraries. These libraries require additional installation. The installation tools are mainly setuptools and pip (not to mention the difference between the two tools here).

Let's talk about how to install setuptools and MongoDb drivers offline on the server (our server is absolutely not allowed to access the external network, even for a second).

Install setuptools

Download setuptools-1.4.2.tar.gz

After unzipping, go to the home directory and execute pythonsetup.pyinstall.

If the installation process prompts that the corresponding py package is missing, install the corresponding package through yum (below).

Then recompile and install py, and if you continue, the installation will be successful.

Note that the following packages are usually missing

After yuminstallzlib-develobzip 2-dev OpenSSL-dev ncurs-dev SqLite-dev installs setuptools, you can install the mongodb driver.

This is the end of "how to upgrade Python and Mongodb drivers in Centos". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report