How to better develop Python's six features on Visual Studio!

Source: Internet
Author: User
Tags virtual environment
Visual Studio 2013/2015 is paired with the Python Tools for Visual Studio Expansion suite to enable Visual Studio to provide a highly integrated development environment for the Python programming language and to fully play the visual Studi o Powerful features to help you develop Python programs in Visual Studio to enhance development efficiency!

The following describes the advantages of the six Visual Studio integrated development Python program.

    1. Integrated Python Interpreter (interpreter) & Interactive window (Interactive)


    2. Integrated Python Virtual Development Environment (Vsan environment)


    3. Integrated Python Suite Administrator (Package Manager)


    4. IntelliSense full support for Python


    5. Using debug mode for Python (debugging)


    6. Cross-platform remote debugging (remote debugging)

Integrated Python Interpreter (interpreter) & Interactive window (Interactive)

Visual Studio is a highly integrated Python interpreter that allows you to switch between different versions of the Python interpreter during development. This feature, in addition to being able to switch to the Python version you are familiar with, ensures that the function compatibility of your program running under different Python versions is legal, such as the print function in the code, which is legal in the Python 2.7 environment (the Red arrow points to the current use of the Pyth On 2.7 Full-domain environment interpreter).

If your system has a different version of the interpreter installed, you will be integrated into Visual Studio for your choice. You can also add a custom interpreter to Visual Studio If you are installing the path of a literal interpreter, or if you wish to customize the translation of the interpreter's library or literal translation device.

We then demonstrated switching to a different version of the Python environment, where we switched to Python 3.5 for example.

At this point, Visual Studio automatically detects functions that are not supported by the version of the environment, and prompts the user for the wrong code snippet by quoting a quotation mark, providing a quick way for the user to find out the incompatibility between different versions to quickly fix the work.

And to launch a different version of the Interactive (Interactive) window within Visual Studio, just like what you did in the Python command column, this interactive window provides you with a simple execution environment for initial writing, testing, and validating your design ideas.

Integrated Python Virtual Development Environment (Vsan environment)

Visual Studio provides a complete Python virtual environment to provide a separate Python execution environment for different projects, thus avoiding the need for multiple projects to share a global environment so that there are too many packages unrelated to the project in the environment, increasing the complexity of the development environment. Or you can install different versions of the suite in different environments to test whether the functions used in different versions of the suite are not the same.

For example, we create multiple virtual environments, which are used to install different versions of suites for compatibility testing, and the created virtual environment can be used later for other projects, reducing the set-up time spent Fai installation and creating environments.

When creating a virtual environment, requirements files can be generated through other virtual environments or installed packages in a global environment, which can be used as a reference when creating a new virtual environment later, providing a list of packages needed to quickly set up a new virtual environment.

Integrated Python Suite Administrator (Package Manager)

There are many useful third-party suites in Python that can be installed through PIP or Easy_install suite administrators, allowing you to call the functions in these suites in your code to help you achieve your development goals faster. The integration of these suite administrators in Visual Studio allows you to easily install packages without having to enter cumbersome instructions.

For example, you can see the option to install the Python suite by clicking the right mouse button in the Python environment where the package is installed within the Solution Explorer.

Then enter the name of the suite you want to install, where you can also specify a version installation, or install the latest version of the suite without specifying it. It is also important to note that if you use the Easy_install option, you will not integrate the packages you are about to install into Solution Explorer, so that you will not be able to use Visual Studio to fully manage these packages that are installed through Easy_install.

IntelliSense full support for Python

Visual Studio also provides support for Python in the past, such as C #, VB, VC + +, and other languages, such as listing object members, function call parameters and return value information, quick consultation, and auto-complete text. Allows you to write objects or call a function more confident, improve the efficiency of writing.

The show IntelliSense feature assists in listing member content that is exposed in an object.

The show IntelliSense feature provides function call parameter information.

In addition, IntelliSense provides quick actions, such as typing main and then pressing "T to help you complete the appropriate code sections and related references automatically.

Using debug mode for Python (debugging)

Visual Studio supports full debugging functionality for Python, such as being able to temporarily stop at a breakpoint while the program is executing, allowing you to view or modify the current execution area variables and call stacking, and to use the important features you are familiar with in debug mode to make it easier and faster to master program execution.

In addition, Visual Studio supports python with muddy debug mode (Mixed-mode debugging), and if your Python code has an original code that uses Native code such as C + + and that has the Native code The muddy debug mode can be performed at the time of the project. As with the General debug mode, languages outside of Python can still change their variable values by entering breakpoints.

Similarly, you can freely jump to different code call stacks to navigate through code and variables in mixed debug mode.

Version control

Visual Studio consolidates versioning, which supports Git and Visual Studio Team Services versioning, and through Visual Studio you now have the ability to pytho directly within Visual Studio without the need for additional tools n the common functions used by version control, such as version submission, recovery, comparison, and viewing of code history, directly from the project.

Cross-platform remote debugging (remote debugging)

Visual Studio has added remote debugging capabilities to Python programs, allowing you to use Visual Studio to connect Python programs that are executed on different job systems, such as Linux. This feature enables you to gain a consistent development experience and improve overall development efficiency when you cross-platform development!

If the show Python program works on a Linux embedded Development Board while Windows 10 in the PC is running Visual Studio 2015, its Ptvsd suite allows you to attach the remote to the sequence, directly to the Linux embedded Development Board running on the Py The Thon program does the debugging mode that you are familiar with. and maintain a complete debug mode function such as regional variable view, call stack analysis and other complete debugging function to carry out the analysis and tracking of the program.

Reference information:

PTVS Film Teaching Course

Open Source –github/microsoft/ptvs

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.