[Python ①] python introduction, installation and configuration, and python introduction Configuration

Source: Internet
Author: User

[Python ①] python introduction, installation and configuration, and python introduction Configuration

  Start learning python today and record some of your experiences and knowledge points. If you have any questions or omissions, please let me know. All subsequent codes are written in Python 3.3.2 (running environment: Windows7.

  Appendix: Tianyi programming language ranking in August 2014

Python: https://www.python.org/downloads/ (updated to 3.4.1/2.7.8 currently)

About python

Python is an object-oriented and interpreted computer programming language. It was invented by Guido van rosum at the end of 1989. The first public release was released in 1991. Python is a simple and clear syntax with rich and powerful class libraries. It is often nicknamed the glue language. Its syntax is concise and clear. It tries its best to use English words without ambiguity. Unlike most programming languages, it uses braces.IndentTo define statement blocks.

The design philosophy of Python is "elegant", "clear", and "simple ". Therefore, the idea of "there are always multiple ways to do the same thing" in its rival Perl language is often intolerable for Python developers. The philosophy of Python developers is "one method, preferably one method, to do one thing ". When designing the Python language, Python developers usually refuse to use fancy syntaxes if there are multiple choices, but select clear or rarely ambiguous syntaxes. Due to this difference in design concepts, Python source code is generally considered to be more readable than Perl and can support large-scale software development. These rules are called"Python motto". Run in the Python Interpreterimport thisYou can obtain the complete list.

>>> import thisThe Zen of Python, by Tim PetersBeautiful is better than ugly.Explicit is better than implicit.Simple is better than complex.Complex is better than complicated.Flat is better than nested.Sparse is better than dense.Readability counts.Special cases aren't special enough to break the rules.Although practicality beats purity.Errors should never pass silently.Unless explicitly silenced.In the face of ambiguity, refuse the temptation to guess.There should be one-- and preferably only one --obvious way to do it.Although that way may not be obvious at first unless you're Dutch.Now is better than never.Although never is often better than *right* now.If the implementation is hard to explain, it's a bad idea.If the implementation is easy to explain, it may be a good idea.Namespaces are one honking great idea -- let's do more of those!>>> 

 

2. x or 3.x

Currently, Python has two versions, one of which is 2. version x, one is 3. version x, these two versions are not compatible, because now Python is moving toward 3. x version evolution, in the process of evolution, a large number of targeting 2. the Code of Version x must be modified before it can be run. Therefore, many third-party libraries are currently unavailable. x.

The author chooses version 3.x for learning.

Environment variable configuration

This is because Windows checks for python.exe based on the environment variable of a pathpath. If not, an error is returned. The final solution is to add the Path D: \ Program Files (x86) \ Python 3.3.2 where python.exe is located to Path. Right-click Properties on the desktop, and click "Advanced System settings" and "environment variables" to open the "environment variables" window. In the system variables, find the "Path" variable, click "edit ":

In the "Edit System variables" window, you can see that the variable name is Path. At the end of the variable value, add a semicolon ";" (note that the English input method is used, do not enter a Chinese semicolon), and then write D: \ Program Files (x86) \ Python 3.3.2 (Your python installation directory), And then click "OK" consecutively ".

Open cmd and enter python for testing.

  

When you see the figure above, it indicates that the Python configuration is successful. Enterexit()Press enter to exit the python environment.

Summary of the day

Python introduction, how to install and configure on Windows to exit the Python interactive environment.


Python Installation

If windows is used,
(1) If the environment variable is not configured (as you do now), you can do this if you want to open the python interpreter in the command line: to switch to the C drive in the command line, then, use cd to go to your python directory (for example, Python25 in drive C) and then use python-v to open the python interpreter as you wish.
(2) Is it too troublesome! So add the python directory to the environment variable. Take win7 as an example:
Right-click "computer", click "properties", click "Advanced System Configuration" on the left, find the PATH above, and click "edit". Then, do not delete the content, just add your python path after the content (Note: if the original content does not end with a semicolon, add a semicolon ), assume that the original content does not end with a semicolon. Assume that your python path is
In the C drive, you need to append the original content; C:/Python25; (Note the semicolon), and then click OK. Now open the command line, in any directory, you only need to enter python and press enter to enter the python interpreter.
(3) Now all python versions have reached 3.2. How can we still use 2.5!

How is the Python environment configured?

Add C: \ Python26; to the Path.
(Depends on your Python installation path and Python version .)

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.