'Pycharm External tools relative to Virtual Environment
Using the PyCharm IDE, when setting up an external tool, how can you set up the external tools with a path relative to use the current virtual env defaults.?
An example being pylint - where I'd want the virtual env version and not the system one to run.
Solution 1:[1]
There's JDKPath macro you can use which points to the executable of the interpreter set for a project. You can combine this with the fact that many tools can be run by directly running their module(s) using the -m
option of interpreter. Also there's issue PY-2734 New useful macros in external tools everyone can vote on.
Solution 2:[2]
Not sure about older versions, but in PyCharm 5 one can use $PyInterpreterDirectory$
macro. It's exactly that we want
Solution 3:[3]
just found your post while looking for documentation about the "variables" that could bew used when setting parameters for external tools.
No documentation but you can see a list of all the available stuff after pressing thE "INSERT MACRO" button in the Edit Tool dialog.
I don't see any reference to the interpreter path there but I usually use the virtualenv as my project path. If you are doing that too you could infer the python interpreter path from there.
Solution 4:[4]
In Tool Settings, set Program:
to $PyInterpreterDirectory$/pylint
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Piotr Dobrogost |
Solution 2 | El Ruso |
Solution 3 | tom stratton |
Solution 4 | Michael Hall |