Python-Supported systems
1. Windows
2.Linux
3.Mac
Install Python under Linux
See if you have installed Python:rpm-q python//landlord with the CentOS6.5, the system has come with
1, install Ipython (under Linux we can enter Python directly into the editing interface, but this interface has a lot of unsupported features, such as the table key can not be filled and so on, so we want to re-install a Python interface, this thing is called Ipython, Install Ipython with pip command, if no this command is installed with Yum install–y python-pip):pip install Ipython (If you cannot install the Ipython version is too high to match your Python version, you can specify a low version to install: Pip installs ipython==1.2.1, of course you can also use yum install–y ipython To install, but the version will be a bit lower than the PIP installation)
2, input Ipython can enter the editing interface
Install Python under Windows
1. Go to Python's website: www.python.org
2.downloads–windows (the choice of version does not matter)
3. Install directly after download (default installed on C:\Python27)
4. Add this path to the environment variable
My Computer – Properties – Advanced system Settings – Advanced – Environment variables
NEW: variable named path, variable value is C:\Python27
Open CLI Direct Input Python Enter to enter the Python editing interface
Basic Python operations
To view the version number of Python:python–v
Enter the Python editing interface:python(the interface that comes in is called the Interactive Python interpreter)
Exit the Python Edit interface:exit ()(shortcut is CTRL + D)
How to edit Python
Method 1: Enter Python directly into the editing interface
Method 2: Enter Ipython directly into the editing interface
Method 3: Create a file with a. py suffix name and edit it to execute Python + filename after editing
Expand your knowledge
1. What is idle
Idle is the default IDE for Python (Integrated development environment), such as entering Python directly to enter the idle
2.python reasons for using/usr/bin/env
In some python or shell scripts, you often see/usr/bin/env, which is why? Why use/usr/bin/env to start a program?
Why the script starts with Env: The script interpreter may be installed in different directories in Linux, env can be found in the path directory of the system, and Env also specifies some system environment variables. Env is useful when you are unsure of the exact path to Python or if the path to Python changes frequently.
Results after Env is performed:
Env Xdg_session_id=2hostname=rootshell=/bin/bashterm=xtermhistsize=1000ssh_client=192.168.230.15509422ssh_tty=/dev /pts/0user=rootpath=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/binmail=/var/spool/mail/rootpwd=/ Rootlang=zh_cn. utf-8histcontrol=ignoredupshome=/rootshlvl=2logname=rootssh_connection= 192.168.230.155094192.168.230.322lessopen=| | /usr/bin/lesspipe.sh%sxdg_runtime_dir=/run/user/0_=/usr/bin/env
If the interpreter path is written dead in the script, there may be compatibility issues with the interpreter not found on some systems.
3. Why not use Perl
The advantage of Perl: Perl's biggest advantage is its string pattern matching capability, which provides a very powerful regular expression matching engine. This makes Perl actually a language for filtering, identifying, and extracting string literals, and it has been the most popular language for developing Web server-side CGI Web programs. Python's regular expression engine is largely Perl-based
The disadvantage of Perl: the obscure language of Perl and the overuse of symbolic grammar make it difficult to interpret the grammar so that beginners do not have the essentials, and they bring a great barrier to their learning. This extra feature of Perl makes it possible to accomplish the same task in multiple ways, which in turn leads to differences between developers. Finally, you have to turn to a reference book when you want to read a Perl script that was a few months old.
4. What is Jython, Cpython, PyPy, IronPython
Jython is a completely Java-developed Python interpreter, and in Jython's scripting environment you can work with Java objects, and Java can interact with Python objects just as Java has always been part of the Python environment.
Cpython: Python interpreter developed with C
PyPy: A python-developed interpreter (exactly a python subset)
IronPython: Interpreter developed in C #
Installation of Python