[Python] Python Configuration
Environment variable configuration in window
By default, after python is installed in windows, the system does not automatically add corresponding environment variables. In this case, you cannot directly use python commands in the command line.
① First, register the python environment variable in the system. Assume that the installation path of python is d: \ IT \ python27, modify the PATH in my computer> Properties> advanced> environment variables> system variables:
; D: \ IT \ python27;
(To run the pythoncommand in the command line, add the directory of python.exe to the path environment variable .)
After the preceding environment variables are successfully set, you can directly use the python command on the command line. Or run "python *. py" to run the python script.
② At this time, you can only run the python script through "python *. py". If you want to run *. py directly, you only need to modify another environment variable PATHEXT:
Add;. PY;. PYM to the environment variable PATHEXT.
After the preceding environment variables are successfully set, you can directly run the python script using "*. py" on the command line.
③ How can I enable the Python interpreter to directly import third-party modules other than the default installation path?
To import third-party modules (such as self-written modules) outside the default installation path, you need to create a new PYTHONPATH environment variable with the value of the directory where the module is located.
Notepad ++ runs python
① Open notepad ++, run F5, or click Run;
② This step is the most critical. copy and paste the following statements into the input box:
Cmd/k python "$ (FULL_CURRENT_PATH)" & PAUSE & EXIT
Click Save
Run the following command:
Cmd/k means to execute the following Command and keep the window after execution (that is, cmd indicates to open the Command Prompt window and run the Command-python following/k)
Cmd/k python = start-> Run-> input cmd-> input python
$ (FULL_CURRENT_PATH) indicates the complete path of the current file. This is the macro definition of Notepad ++.
& Connecting multiple commands
PAUSE indicates that the task is paused after the operation is completed. Wait for any key.
EXIT indicates closing the command line window (if cmd/c is used, EXIT can be saved .)
In the ShZ environment? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> vcn1_dxs0sl/ceiling + ceiling/svd28/ceiling + CiAgICAgICAgICC/7L3dvPzSsr/ceiling + HG8NCno6y2 + mfw.u/ 7L3dvPy/ydLU0N64xKOsy/nS1M7e0Ou1o9DEo6jA/hybrid/MHuoaM8YnI + c1_vcd4kpha + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20140917/20140917084352334.jpg" alt = "\">
Setting result:
③ Test:
Sublime Text 2 configure the Python Environment
① Click Preferences in the toolbar to open Browse Packages. Find Python in the opened folder and open the folder. Find the Python. sublime-build File and open it.
② Modify the following content:
③ Modify the content in path to the installation directory of the compiler. Save the code and press ctrl + B to run it.