one. Install python under Windows1 "The Python suffix on Windows is. msi, and after downloading it, run it directly by double-clicking. The Python.exe file is generated in the C drive and the Python.exe file is added to the Windows environment variable: My Computer---properties---advanced---environment variables--edit--Add "c:\python27"--Determine C: \ Python27 C:\Python27\Scripts :https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi 2 After installing Python under Windows, enter cmd, enter Python, and go to the Python command line3 "Windows Authentication python and exit4 "Windows quits Python exit () two. Install Python under Linux1 "Yum source installationinstall PIP command, install Ipython with PIP (pip install python)[email protected] ~]# CD soft/[[email protected] soft]# lsepel-release-6-8.noarch.rpm[email protected] soft]# RPM-IVH epel-release-6-8.noarch.rpmwarning:epel-release-6-8.noarch.rpm:header V3 rsa/sha256 Signature, key ID 0608b895:nokeyPreparing ... ########################################### [100%]1:epel-release ########################################### [100%][email protected] soft]# cd/etc/yum.repos.d/[[email protected] yum.repos.d]# ls//yum directory generated Epel Epel-testing.repoa bak centos-base.repo epel.repo epel-testing.repo[email protected] yum.repos.d]# yum-y install Python-pip[[email protected] yum.repos.d]# pip install Ipython//install Ipython, will be installed via the Ipython's official website, download the current latest version, note that Linux in the version of Python is 2.6, the current version of the latest Iptyon is 6.0, the site is described using Python3, so, after installation error[[email protected] yum.repos.d]# pip install ipython==1.2.1//Specify Ipython version to install,... Installing collected Packages:ipythonRunning setup.py Install for Ipythonsuccessfully installed ipython-1.2.1..... [[email protected] yum.repos.d]# PIP list//viewYou are using the PIP version 7.1.0, however version 9.0.1 is available.You should consider upgrading via the ' pip install--upgrade pip ' command.Distribute (0.6.10)iniparse (0.3.1)Ipython (1.2.1)Pip (7.1.0)Pycurl (7.19.0)pygments (2.2.0)Pygpgme (0.1)PYXDG (0.18)setuptools (0.6RC11)Six (1.10.0)Urlgrabber (3.9.1)Yum-metadata-parser (1.1.2)[[email protected] yum.repos.d]# ipython //Input Ipython command will be entered under Python, with full complement function Python 2.6.6 (r266:84292, Nov, 12:16:22)Type "Copyright", "credits" or "license" for more information.IPython 1.2.1--an enhanced Interactive Python.? Introduction and overview of IPython ' s features.%quickref, Quick reference.Help, Python ' s own Help system.object? Details about ' object ', use ' object? ' for extra details.In [1]:2 "Source Installation Ipython[[email protected] soft]# ls51CTO Download-ipython-1.2.1.tar.gz[[email protected] soft]# tar xf 51CTO download-ipython-1.2.1.tar.gz[[email protected] soft]# ls51CTO Download-ipython-1.2.1.tar.gz redis-3.2.8.tar.gzipython-1.2.1 zabbix-2.0.12.tar.gzmongodb-linux-x86_64-rhel62-3.2.7.tgz[email protected] soft]# CD IPYTHON-1.2.1/[[email protected] ipython-1.2.1]# lsCOPYING.txt Examples Pkg-info scripts setupegg.py setup.pydocs IPython readme.rst setupbase.py setupext[[email protected] ipython-1.2.1]# python setup.py install//python Execute setup script, you can complete with IpythonThree. Configure environment variables for different operating systems1 "Configuring Windows System Environment VariablesWIN10 Operating system environment variables add executable programs at the following path:My Computer---properties---advanced---environment variables--edit--Add2 "Linux system environment variable configurationFor example, to add PHP commands, PHP is installed under/usr/local/webserver/php. Add PHP commands permanently:[[email protected] ~]# vim/etc/profile//Add the following two lines to the end of the file.................................................#phpexport Path=/usr/local/webserver/php/bin: $PATH[[email protected] ~]# Source/etc/profile//is an environment variable in effectfour. Python starts with "Hello World"#/usr/bin/python#coding =utf-8# @Time: 2017/10/16 8:59# @Auther: Liuzhenchuan# @File:p Ython starts with Hello world. Pya = ' hell world ' print a print ' # # # '* name = raw_input(' please input ' name: ') print ' Hell World%s ' % name >>> Hell World ###############################################Please input Name:liuzhenchuanHell World Liuzhenchuan
Python Basics 1.1