Learning python python -2 installation and set environment variables

Download python

1. You can go to the official website to download python, https://www.python.org/

2. After the download is complete, you can install. (Specific Baidu, the Internet has a lot of installation method)

 

python detection

1. Open the Start - Run -cmd (shortcut win + R). If mac, opened using Tools - Terminal

2. Enter in the terminal python, the python is to enter the following screen indicating successful installation

 

 

python environment variable

Here is an example win10

1. Right My Computer - Properties - Advanced

 

2. Select the environment variable --- found in the system variable in the Path --- then double-click to go after new, add python to go in the path

 

 

After the cmd environment variables set to run python on a lot of convenience. (Do not understand can go to Baidu search, these installations change the environment variables There are many online, do not say nonsense)

NOTE: If you have multiple versions of python installed, run cmd in the python, the general operation of the computer to install the default priority.

Solutions can rename the python, and then set the environment variable, so you can run in cmd in. For example: python2 python3 run cmd and direct input or python2 python3 can.

 

 

3. Variable names

Can the letter / number / underscore

ps: ~ The numbers do not begin with

       - not be a keyword (and, as, assert, break, class, continue, def, del, elif, else, except, exec, finally, for, from, global, if, import, etc.)

       ~ Best not to repeat things and built-in python

       ~ Best to write meaningful variable name, a name you can look at to understand what it is. For example: user_name user_age user_id

 

Guess you like

Origin www.cnblogs.com/liujinjing521/p/10972656.html