centos--upgrade Python2.7 and install Pip

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


CentOS Upgrade Python2.7 and install pip1) upgrade Python2.7?python -V # View version: Python2.6.6mkdir -p ~ / Env / python; cd ~ / Env / python # Create a directory wget --no-check-certificate https://www.python.org/ftp/python /2.7.6/Python-2.7.6.tar.xztar Jxvf Python-2.7.6.tar.xzcd Python-2.7.6./configure --prefix = / usr / local / py-2.7.6 # "./ "configure -h" check the help make # report module missing, need to reinstall after make # issue: INFO: Can't locate Tcl / Tk libs and / or headers # Python build finished, but the necessary bits to build these modules were not found: # ... # Note 1: zlib is necessary, and setuptools will be used later. See "Installing setuptools". # Note 2: openssl is necessary, pip will be used later. See "Installing pip". # Note 3: It is best to add bzip2, execute "yum install bzip2 bzip2-devel -y". make install # Create a soft link, pointing to Python2.7mv / usr / bin / python /usr/bin/python2.6.6ln -s /usr/local/py-2.7.6/bin/python2.7/usr/bin/ pythonpython -V # Python2.7.6 # yum is not compatible with Python2.7 and needs to be specified as the original version vi / usr / bin / yum # Change "! / usr / bin / python" to "! /usr/bin/python2.6.6 "# ibus is also not compatible with Python2.7, you need to modify # change" exec python "to" exec python2.6.6 "ll / usr / bin | grep python # Make sure python2.6.6vi / usr / bin / ibus-setup # Modify vi / usr / libexec / ibus-ui-gtk # modify reboot # may need to restart
2) Prepare the Base environment 2.1) install Setuptools?cd ~ / Env / pythonwget http://pypi.douban.com/packages/source/s/setuptools/setuptools-3.3.tar.gz # Douban source tar zxvf setuptools-3.3.tar.gzcd setuptools-3.3python setup.py buildsudo python setup.py install # Or use ez_setup.py, also change to Douban source # wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py# python ez_setup.py --download-base http : //pypi.douban.com/packages/source/s/setuptools/# zlib is missing and an error occurred while installing setuptools. # issue: RuntimeError: Compression requires the (missing) zlib moduleyum install zlib zlib-devel -y # Remake Python2.7 and install cd ../Python-2.7.6make install # environment variable vi / etc / profile # Add the following content: # PY_HOME = / usr / local / py-2.7.6 # export PATH = $ PY_HOME / bin: $ PATHsource / etc / profile # The current terminal takes effect, only after reboot Will be fully effective echo $ PATH
2.2) Install Pip?easy_install -i http://pypi.douban.com/simple pip # Missing ssl module, error when using pip # issue: ImportError: cannotimportname HTTPSHandleryum install openssl openssl-devel -ymake # Python-2.7.6 directory make install # configure pip Add the following content for Douban source mkdir ~ / .pip # ls or ll -a to view hidden content vi ~ / .pip / pip.conf #: simple
2.3) Install virtualenv?
supip install virtualenvpip install virtualenvwrapper


Virtualenv is used to create an isolated Python runtime environment, which avoids confusion when it relies on different libraries and versions.



The Virtualenvwrapper provides more convenient commands for extensions on the virtualenv.


2.4) Other document
    • Sphinx
      • ' Pip install Sphinx '
Network
    • Twisted
      • ' Pip install Twisted '
      • Zope.interface
    • Scrapy
      • ' Pip install Scrapy '
Web Framework
    • Django
      • ' Pip install Django '
    • Tornado
      • ' Pip install Tornado '
    • Flask
      • ' Pip install Flask '


centos--upgrade Python2.7 and install Pip


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.