-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Python Path and Version
At the moment shebang is supported only on Windows. Until then the version of python used for standard editor functions (intellisense, linting, formatting, etc.) and debugging needs to be configured individually.
###Paths
All samples provided here are for windows.
However Mac/Linux paths are also supported.
The same python interpreter is used for intellisense, autocomplete, linting, formatting, etc. (everything other than debugging). The standard interpreter used is the first "python" interpreter encountered in the current path. If a different version is to be used, this can be configured in one of two ways:
- Configure the path to the python interpreter in the User Settings file (settings.json) as follows.
Ensure to specify the fully qualified name of the python executable.
"python.pythonPath": "c:/python27/python.exe"
- Configure the path to the python interpreter in the Workspace Settings file (settings.json) as follows.
Ensure to specify the fully qualified name of the python executable.
"python.pythonPath": "c:/python27/python.exe"
If using a Virtual Environment, ensure the path to the python interpreter is set in python.pythonPath as defined above. For code Intellisense, Auto complete and the like to work, you will also need to configure the python.autoComplete.extraPaths, on top of the python.pythonPath as follows:
{
"python.pythonPath": "/home/xxx/dev/ala/venv/bin/python",
"python.autoComplete.extraPaths": [
"/home/xxx/dev/ala/venv/lib/python2.7",
"/home/xxx/dev/ala/venv/lib/python2.7/site-packages"
]
}
Unfortunately the python.pythonPath is not used by the Linters when dealing with a Virtual Environment. For the moment, you will need to ensure the fully qualified path to the linters are provided. This will be fixed in a future release #148.
Details on configuration settings for debugging can be found here Debugging.
Simply provide the fully qualified path to the python executable in the "python" setting within the configuration settings in the launch.json file as follows:
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"program": "${file}",
"pythonPath": "c:/python27/python.exe",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
}