Walkthrough of Python 2.6 upgrade to Python 2.7

Source: Internet
Author: User
This article mainly describes the Python 2.6 upgrade to Python 2.7 practice experience, with a certain reference value, interested in small partners can refer to

Objective

CentOS 6.8 installs Python 2.7.13 because of the requirements on the software version so consider upgrading Python to 2.7.13, plus the production environment or RHEL 6, most of the Internet Automation operations platform is also recommended for Python 2.7.x + CentOS 6 . x to operate, choose Python 2 or Python 3 is not conclusive, find the right match.

Simple installation

Because Python 2.7.13 later will automatically refine the Yum configuration, it's not necessary to refer to previous online articles to modify other places

# View the Python version in the current system, return to Python 2.6.6 for normal python--versionpython 2.6.6# check CentOS version, return to CentOS Release 6.8 (Final) as normal cat/e Tc/redhat-releasecentos Release 6.8 (Final) # Install all development Kits Yum Groupinstall-y "Development Tools" # Install additional required packages Yum Install-y Zli B-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel# Download, compile, and install Python 2.7.13#wget https://www.python.org/ftp/ Python/2.7.13/python-2.7.13.tgztar zxf python-2.7.13.tgzcd python-2.7.13./configuremake && make install# view the new Python version, return python 2.7.13 to normal python--versionpython 2.7.13

Ansible Offline Installation Practice

Here are some tips for offline installation of ansible in the intranet.

# Install Pythontar XF python-2.7.13.tgzcd python-2.7.13./configuremakemake install# importerror:no module named Six.mov Estar XF six-1.10.0.tar.gzcd six-1.10.0python setup.py installcd. # importerror:no module named Packaging.versiontar XF packaging-16.8.tar.gzcd packaging-16.8python setup.py installcd. # importerror:no module named Pyparsingtar XF pyparsing-2.2.0.tar.gzcd pyparsing-2.2.0python setup.py installcd. # importerror:no module named Appdirstar XF appdirs-1.4.3.tar.gzcd appdirs-1.4.3python setup.py installcd. # Install Setuptoolsunzip setuptools-34.2.0.zipcd setuptools-34.2.0python setup.py installcd. # Install Piptar XF pip-9.0.1.tar.gzcd pip-9.0.1python setup.py installcd. # pip offline download dependency package pip install-d ~/tmp/ansiblepip install-d ~/tmp/ansible-cmdb# pip offline install pip install ansible--index-url=http ://172.31.197.1:7000/simple/--trusted-host=172.31.197.1pip Install Ansible-cmdb--index-url=http:// 172.31.197.1:7000/simple/--trusted-host=172.31.197.1# View the installed version [Root@ansibLe-wangao ansible]# pip-vpip 9.0.1 From/usr/local/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7) [ Root@ansible-wangao ansible]# ansible--versionansible 2.3.0.0 config file =/etc/ansible/ansible.cfg configured module s Earch Path = default w/o overrides python Version = 2.7.13 (Default, APR, 17:19:23) [GCC 4.4.7 20120313 (Red Hat 4 .4.7-17)][root@ansible-wangao ansible]# ansible-cmdb--versionansible-cmdb v1.20# Replace the watercress pip source vim $HOME/.pip/pip.conf[ Global]index-url = https://pypi.doubanio.com/simple/[install]trusted-host=pypi.doubanio.com

Windows installation Python 2.7.x

Download python, such as 2.7.13

Https://www.python.org/downlo ...

Https://www.python.org/ftp/py ...

Installation Note Check the environment variable add Python.exe to Path

Install python2.7.13 default own PIP version is 9.0.1

PS c:usersadministrator> Pip-v

Pip 9.0.1 from C:python27libsite-packages (Python 2.7)

Upgrade pippython-m pip install--upgrade pip after installing Python

# Replace PyPI domestic source, run the following Python code will automatically establish Pip.iniimport osini= "" "[Global]index-url = Https://pypi.doubanio.com/simple/[install] Trusted-host=pypi.doubanio.com "" "pippath=os.environ[" UserProfile "]+" \\pip\\ "If not os.path.exists (Pippath):  Os.mkdir (Pippath) with open (pippath+ "Pip.ini", "w+") as F:  f.write (INI)

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.