CentOS x86 64bit upgrade to Python2.6 to 2.7

Source: Internet
Author: User

CentOS x86 64bit upgrade to Python2.6 to 2.7

Because the project uses Django1.7.1, It works with Python 2.7, 3.2, 3.3, or 3.4, and my CentOS x86 64bit system comes with Python 2.6.6, You need to upgrade It to Python 2.7.

The upgrade is completed by referring to three articles on the Internet, but note the following three points:

(1) because some existing software in the system depends on python2.6.6, You Cannot uninstall the existing version and reinstall python2.7. Otherwise, directly upgrade to python2.7 may cause yum to become unavailable.

See the article: Upgrade python2.6.6 to Python2.7.3.

(2) To avoid garbled direction keys when entering the python interpreter environment, it is best to confirm whether the readline-devel module is installed before the upgrade.

See the article: complete the installation of the readline-devel module.

(3) After the upgrade, when you enter the python interpreter to execute import django, an error is returned: ImportError: No module named django.

See article: Workshop.

Note: If you use pip to install Django, run the following command to view the current Django installation directory:

Pip show Django

(4) In addition, new problems are encountered after the upgrade is completed. Run: "django-admin.py startproject ttt" to report error:

Traceback (most recent call last ):
File "/usr/bin/django-admin.py", line 5, in <module>
Management.exe cute_from_command_line ()
File "/usr/lib/python2.6/site-packages/django/core/management/_ init _. py", line 385, in

Execute_from_command_line
Utility.exe cute ()
File "/usr/lib/python2.6/site-packages/django/core/management/_ init _. py", line 354, in

Execute
Django. setup ()
File "/usr/lib/python2.6/site-packages/django/_ init _. py", line 18, in setup
From django. utils. log import configure_logging
File "/usr/lib/python2.6/site-packages/django/utils/log. py", line 13, in <module>
From django. views. debug import ExceptionReporter, get_exception_reporter_filter
File "/usr/lib/python2.6/site-packages/django/views/debug. py", line 10, in <module>
From django. http import (HttpResponse, HttpResponseServerError,
File "/usr/lib/python2.6/site-packages/django/http/_ init _. py", line 2, in <module>
From django. http. request import (HttpRequest, QueryDict,
File "/usr/lib/python2.6/site-packages/django/http/request. py", line 12, in <module>
From django. core import signing
File "/usr/lib/python2.6/site-packages/django/core/signing. py", line 41, in <module>
Import zlib
ImportError: No module named zlib

Because the zlib-devel package is missing, the solution is as follows:

Install the zlib-devel package
Shell> sudo yum install zlib-devel

Recompile and install Python
Shell>./configure -- with-zlib
Shell> make
Shell> sudo make install

When installing the MySQLdb module, an error is always reported, and a sentence is displayed in the setup. cfg file:

Build-requires = python-devel mysql-devel zlib-devel openssl-devel

Install the required software package first:

Yum install python-devel mysql-devel zlib-devel openssl-devel

OK! Solve the problem.

-------------------------------------- Split line --------------------------------------

Install Python3.4 on CentOS source code

Python core programming version 2. (Wesley J. Chun). [Chinese version of hd pdf]

Python development technology details. (Zhou Wei, Zong Jie). [hd PDF scan version + book guide video + code]

Obtain Linux information using a Python script

Build a desktop algorithm transaction research environment using Python in Ubuntu

A Brief History of Python Development

Python details: click here
Python: click here

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.