CentOS Yum installation python2.7 and common error handling

Source: Internet
Author: User
Tags install openssl install django pip install django

First, the installation steps are as follows:
1) Install Development tools
Yum Groupinstall "Development tools"

2) Install the packages needed to compile Python

Yum Install Zlib-devel
Yum Install Bzip2-devel
Yum Install Openssl-devel
Yum Install Ncurses-devel
Yum Install Sqlite-devel

3) Download and unzip the source code of the Python 2.7.9

Cd/data/app
wget--no-check-certificate Https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
Tar xxf python-2.7.9.tar.xz
CD Python-2.7.9

4) Compiling and installing Python 2.7.9
./configure--prefix=/usr/local
Make && make Altinstall

5) Point python command to Python 2.7.9
Ln-s/usr/local/bin/python2.7/usr/local/bin/python

6) Check Python version
[Email protected] tmp]# python-v
Python 2.7.9


Second, install Pip

Pip is a tool for installing and managing Python packages and is a replacement for Easy_install.

No Pip:command not found found after installing Python

Installation and download:

wget--no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
Note: When wget gets HTTPS, add:--no-check-certificate
TAR-ZVXF 1.5.5.tar.gz #解压文件
CD pip-1.5.5/
Python setup.py Install

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8C/7A/wKioL1ht-F3CE3dlAAAtwDcOVCc636.png "title=" Cc.png "alt=" Wkiol1ht-f3ce3dlaaatwdcovcc636.png "/>

Processing:

Importerror:no module named Setuptools Workaround:

Note: (Setuptools under Python comes with a easy_install tool that is useful and convenient when installing Python's three-party modules and tools. Install PIP before installing Setuptools)


Download Setuptools Package
shell# wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
Unzip the Setuptools bag
shell# TAR-ZXVF setuptools-0.6c11.tar.gz
shell# CD SETUPTOOLS-0.6C11
Compiling Setuptools
shell# python setup.py Build
Start performing setuptools Installation
shell# python setup.py Install
Installation Complete


Verify:

Install Ginger dog pip install ' django==1.5 '

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8C/7E/wKiom1ht-OjAwWVrAACt_HBqbTw957.png "title=" Cv.png "alt=" Wkiom1ht-ojawwvraact_hbqbtw957.png "/>


Third, the Python installation module encountered error and resolution

#没有安装姜狗
importerror:no module named Django.core.management
Pip Install Django


#在Python环境下, if you want to operate the MySQL database, it will inevitably call the corresponding package, such as common: MYSQLDB by importing: Import MySQLdb, you can directly call inside the method.
Error loading mysqldb module:no module named MySQLdb

#pip Install Mysql-python
>>> Import MySQLdb
File "<stdin>", line 1
Import MySQLdb
^
indentationerror:unexpected Indent
>>>

#软链接
Ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib64/libmysqlclient.so.18

>>> Import MySQLdb
>>>
>>>


#IOError: No translation files found for default language ZH_CN
#其中 Zh-hans is Simplified Chinese zh-hant is traditional Chinese

File "/usr/local/python2.7.12/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 134, in __ init__
Raise IOError ("No translation files found for default language%s."% settings. Language_code)
Ioerror:no translation files found for default language ZH_CN.
Processing:
The settings.py in the Language_code configuration zh-cn, changed to Zh-hans.
Language_code = ' Zh-hans '



#blog. Ad.image_url: (Fields. E210) cannot use ImageField becausePillow is not installed
Installing the mounting Pillow
Pip Install--use-wheel Pillow #安装最新的Pillow


#项目名字叫: Xadmin, new features include: Basic compatibility with Django Admin, only a small change (remove the inheritance of admin can be completely based on the Bootstrap UI framework, can seamlessly use any Bootstrao theme, support a variety of skin choices.
importerror:no module named Xadmin
Pip Install Django-xadmin


[[email protected]/]# pythonbrew venv Create DJ
-bash:pythonbrew:command not found

[[Email protected]/]# pip install Pythonbrew
Downloading/unpacking Pythonbrew


#python中使用xlrd, XLWT operation Excel table in detail, Python operations Excel mainly use the XLRD and XLWT these two libraries, that is, XLRD is read EXCEL,XLWT is to write Excel library
Pip Install XLWT


================================

Chew the book to see python/(ㄒoㄒ)/~~, life is short, I use Python.


This article is from the "7835882" blog, please be sure to keep this source http://crfsz.blog.51cto.com/7835882/1889350

CentOS Yum installation python2.7 and common error handling

Related Article

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.