Python 2.6 to Python 2.7, python2.6
Preface
To install Python 2.7.13 in CentOS 6.8, upgrade Python to 2.7.13 as required by the software version. In addition, the production environment is still dominated by RHEL 6, most of the Internet automated O & M platforms are recommended to operate on Python 2.7.x + CentOS 6.x. If Python 2 or Python 3 is selected, you can find a proper combination.
Simple Installation
Because yum configuration will be automatically improved in Versions later than Python 2.7.13, you do not need to refer to previous online articles to modify other places.
# Check the Python version in the current system and return Python 2.6.6 as normal python -- versionPython 2.6.6 # Check the CentOS version and return CentOS release 6.8 (Final) cat/etc/redhat-releaseCentOS release 6.8 (Final) # install all Development Kits yum groupinstall-y "Development tools" # install other required packages yum install-y zlib-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 # Check the new Python version and return Python 2.7.13 as normal python -- versionPython 2.7.13
Ansible offline installation practices
Here we use some tips to install ansible offline on the Intranet.
# Install Pythontar xf Python-2.7.13.tgzcd Python-2.7.13. /configuremakemake install # ImportError: No module named six. movestar 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.0pytho N 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 install-d ~ /Tmp/ansiblepip install-d ~ /Tmp/ansible-cmdb # pip offline installation 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. cfg configured module search path = Default w/o overrides python version = 2.7.13 (default, Apr 25 2017, 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 pip source vim $ HOME /. pip/pip. conf [global] index-url = https://pypi.doubanio.com/simple/?install=trusted-host=pypi.doubanio.com
Install Python 2.7.x in Windows
Download Python, such as 2.7.13
Https://www.python.org/downlo...
Https://www.python.org/ftp/py...
Check the environment variable Add python.exe to Path during installation.
Install python2.7.13. The default 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 the pypi domestic source and run the following python code to automatically create 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)
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.