Python Basic Notes Series IV: Installation and configuration of tools

Source: Internet
Author: User
Tags sublime text

This series of tutorials is intended for individual learning notes, and if you want to browse may require other programming language basics (such as C), why? Because I write rotten ah, only I can understand!!
At first, there was no intention of writing the tool, and later found that in some cases there were some strange problems, which are recorded here.

  • Environmental Fundamentals
    I'm using the Windows 10 operating system
    Python version: python2.7 address-->https://www.python.org/downloads/
    Sublime TEXT3: Address-->https://www.sublimetext.com/
  • Install the Python pit:
    Download the installation directly, it is important to note that when installing the pip (not checked by default) and add Python.exe to Path ensure that third-party modules can be installed in the following and add the PATH environment variable in the Windows system.
    Then enter python on the win+r-->cmd command line to display the Python version as the installation succeeds.
    If Python is not available through the Python command after the installation is complete, it is possible that the environment variable is not automatically joined, and the Python installation directory is manually added to the environment variable path.
  • Installing the Ipython Pit:
    IPython is a python interactive shell that works much better than the default Python shell, supports variable auto-completion, auto-indent, supports bash shell commands, and has many useful functions and functions built into it. So beginners can play. Installation method is win+r-->cmd direct input pip install Ipython, need to network Oh ~ If the prompt command does not exist in the main cause of the error two, one is to install Python when the installation pip is not checked, you may need to reinstall Python, The other is that the environment variables of Python are not well configured, so the environment variables can be set up.
  • Install sublimeText3: Download the installation package directly after installation, activation code, degrees Niang well
  • To install the sublime plugin:
    Inbefore installing the sublime plug-in, you need to install the package control component, and then install the plugin directly online:
    1) Sublimecodeintel plug-in
    The Sublimecodeintel plugin enables you to automatically prompt Python code, view system functions, jump-track custom functions, and more.
    Installation: Under the conditions of installing the package control component, ctrl+shift+p type install packages, and then continue typing Sublimecodeintel installation. Also need to configure: Select Perference-package settings-sublimecodeintel-settings-user, copy the following configuration:
    1 {2     "codeintel_language_settings": {3         "Python27": {4             "python27":"D:\\python27\\python.exe",5             "Codeintel_scan_extra_dir": [6                 "D:\\python27\\lib\\idlelib",7                 "C:\\windows\\system32\\python27.zip",8                 "D:\\python27\\dlls", 9                 "D:\\python27\\lib",Ten                 "D:\\python27\\lib\\plat-win", One                 "D:\\PYTHON27\\LIB\\LIB-TK", A                 "d:\\python27",  -                 "d:\\python27\\lib\\site-packages"], -             "Codeintel_scan_files_in_project": True, the             "Codeintel_selected_catalogs": [] -         }, -     } -}

    Here the Python path needs to be defined according to its own installation path, where Codeintel_scan_extra_dir contains directories that can be viewed Sys.path in Python IDLE (which can be found in the directory where Python is installed), Such as:

    If you are using the Python3, do not forget to change the Python27 to Python3 Oh. Finally, Ctrl+s save and restart .
    2) Configure native Python in sublime Text3
    Sublime has a Python compilation environment (which may also be called locally, after all), but if you do not configure native Python, the subsequent use of sublime to write Python requires an import package when the package is not found .
    Configuration: Tools-->build system-->new Build System in the sublime menu ... Enter the following code:

    1 {2  "cmd": ["python","- u","$file"],3  "File_regex":"^[]*file \ "(... *?) \ ", line ([0-9]*)",4  "selector":"Source.python",5  "encoding":"Utf-8",6}

    Then save it and note that the file extension is:. Sublime-build, for example I'm mypython.sublime-build here, and the save path is generally in C:\Users\b6762\AppData\Roaming\Sublime Text 3\packages\user, and then Tools-->build system--> in the selection of the environment you have just defined the name Mypython, after the selection, you can use the CTRL+B directly after the environment to run OH.
      Note: The above code in the "Encoding": "Utf-8" This line of utf-8 parameters, many of the online tutorial is said to see whether the system is the code, the view is win+r open a command prompt, in the title bar right click the mouse click Properties can be seen as shown in:


    However, I this is 936, if changed to "encoding": "cp936", in Sublime Text3 console appears garbled .

    3) write Python in sublime Text3 cannot enter content in console
    After switching to the Python compilation environment in Sublime, Tools->build can compile and run Python, which is the ctrl+b of our usual shortcut keys. After that, the console will appear below. But this can only output in the console cannot be entered .
    Install: Ctrl+shift+p type Install packages, and then continue typing SUBLIMEREPL installation. Then each time the compilation is run: Tools->sublimerepl->python->python-run current file. After clicking the new page *repl*[python], as a new console, you can enter and output the interaction.

Python Basic Notes Series IV: Installation and configuration of tools

Related Article

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.