You can also use the Terminal: Create New Terminal command to create a terminal in which VS Code automatically activates the currently selected interpreter. See Environments below. For a more specific walkthrough on running code, see the tutorial.
The Python extension supports code completion and IntelliSense using the currently selected interpreter. IntelliSense is a general term for a number of features, including intelligent code completion in-context method and variable suggestions across all your files and for built-in and third-party modules.
You can also hover over identifiers for more information about them. IntelliCode provides a set of AI-assisted capabilities for IntelliSense in Python, such as inferring the most relevant auto-completions based on the current code context.
Linting analyzes your Python code for potential errors, making it easy to navigate to and correct different problems. The Python extension can apply a number of different linters including Pylint, pycodestyle, Flake8, mypy, pydocstyle, prospector, and pylama. See Linting. No more print statement debugging! Set breakpoints, inspect data, and use the debug console as you run your program step by step. Debug a number of different types of Python applications, including multi-threaded, web, and remote applications.
For Python-specific details, including setting up your launch. General VS Code debugging information is found in the debugging document. The Django and Flask tutorials also demonstrate debugging in the context of those web apps, including debugging Django page templates. The Python extension automatically detects Python interpreters that are installed in standard locations.
It also detects conda environments as well as virtual environments in the workspace folder. See Configuring Python environments. The selected environment is used for IntelliSense, auto-completions, linting, formatting, and any other language-related feature other than debugging.
It is also activated when you use run Python in a terminal. For corporate and other institutional users, be aware that many organisations have their own policies around using and contributing to open source software. Please take such policies into account when making use of the distribution and installation tools provided with Python. Starting with Python 3. A virtual environment is a semi-isolated Python environment that allows packages to be installed for use by a particular application, rather than being installed system wide.
It allows virtual environments to be used on versions of Python prior to 3. The Python Package Index is a public repository of open source licensed packages made available for use by other Python users. They maintain a variety of tools, documentation, and issue trackers on both GitHub and Bitbucket. While direct use of distutils is being phased out, it still laid the foundation for the current packaging and distribution infrastructure, and it not only remains part of the standard library, but its name lives on in other ways such as the name of the mailing list used to coordinate Python packaging standards development.
Changed in version 3. Python Packaging User Guide: Creating and using virtual environments. The following command will install the latest version of a module and its dependencies from the Python Package Index:.
For Windows users, the examples in this guide assume that the option to adjust the system PATH environment variable was selected when installing Python.
Normally, if a suitable module is already installed, attempting to install it again will have no effect. Upgrading existing modules must be requested explicitly:. More information and resources regarding pip and its capabilities can be found in the Python Packaging User Guide. In particular, you should always install Setuptools, Pip, and Virtualenv — they make it much easier for you to use other third-party Python libraries.
The use of Python 3 is highly preferred over Python 2. Consider upgrading your applications and infrastructure if you find yourself still using Python 2 in production today.
If you are using Python 3, congratulations — you are indeed a person of excellent taste. These guides go over the proper installation of Python for development purposes, as well as setuptools, pip and virtualenv.
0コメント