Specify which python version pylint should evaluate for
You can try python2 -m pylint ...
and python3 -m pylint ...
. That ensures that you use the right version.
AFAIK Pylint lints for the version of Python it is running on and it is not possible to override it.
Expanding on @sthenault's answer and borrowing heavily from @simon's to a very similar question on askubuntu, the solution is to write a wrapper script around pylint
that executes it with the appropriate version of the Python interpreter. Drop the following into a script called mypylint
(or whatever) somewhere in your $PATH
:
#! /usr/bin/env bashpython_interpreter="python${1}"pylint_args="-f colorized ${@:2}"pylint_import=$(cat << PYTHONimport sysimport pkg_resources__requires__ = "pylint"sys.exit( pkg_resources.load_entry_point("pylint", "console_scripts", "pylint")())PYTHON)$python_interpreter -c "$pylint_import" $pylint_args
Then, execute it like so: mypylint 2|3 PYLINT_ARGS
. For instance:
mypylint 2 -f colorized module.py
I'm not sure how you can tie that into sublime-text, but it more generally answers the question of parallel versions of pylint
. I also bundled the above solution into a gist.