|
Since 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 version 2.6.6, so the need to upgrade to version Python2.7.
Upgrade reference online 3 article complete, just need to pay attention to three points:
(1) because some of the existing software system is dependent python2.6.6, it can not be re-installed after uninstalling the existing version python2.7, otherwise directly after upgrade to python2.7 may cause yum and so can not be used.
(2) In order to avoid entering the python interpreter environment arrow keys distortion of the issue, it is best to confirm before the upgrade is installed readline-devel module.
(3) After the upgrade is complete, enter the python interpreter to perform import django, the incorrect report: ImportError: No module named django.
See the article: http: //stackoverflow.com/questions/9462212/import-error-no-module-named-django, set the environment variable: PYTHONPATH can be solved.
PS: If you use pip install Django, you can execute the following command to view the current installation directory of Django:
pip show Django
(4) In addition, after the upgrade is complete and encounter new problems. Executive: "django-admin.py startproject ttt" when being given:
Traceback (most recent call last):
File "/usr/bin/django-admin.py", line 5, in
management.execute_from_command_line ()
File "/usr/lib/python2.6/site-packages/django/core/management/__init__.py", line 385, in
execute_from_command_line
utility.execute ()
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
from django.views.debug import ExceptionReporter, get_exception_reporter_filter
File "/usr/lib/python2.6/site-packages/django/views/debug.py", line 10, in
from django.http import (HttpResponse, HttpResponseServerError,
File "/usr/lib/python2.6/site-packages/django/http/__init__.py", line 2, in
from django.http.request import (HttpRequest, QueryDict,
File "/usr/lib/python2.6/site-packages/django/http/request.py", line 12, in
from django.core import signing
File "/usr/lib/python2.6/site-packages/django/core/signing.py", line 41, in
import zlib
ImportError: No module named zlib
Because of the lack zlib-devel package, the solution is as follows:
Install zlib-devel package
shell> sudo yum install zlib-devel
Recompile install Python
shell> ./ configure --with-zlib
shell> make
shell> sudo make install
When you install MySQLdb module, always being given, then see a word in the file setup.cfg:
build-requires = python-devel mysql-devel zlib-devel openssl-devel
It relies decisively to install packages:
yum install python-devel mysql-devel zlib-devel openssl-devel
OK! The problem is solved. |
|
|
|