[Python] How do I make a global Pylint installation use a local Python interpreter to prevent...

Discussão em 'Python' iniciado por Stack, Maio 8, 2025.

  1. Stack

    Stack Membro Participativo

    I've installed Pylint using pipx, so that it is available across all my virtual environments without having to add Pylint as a development dependency for each project.

    I'm also using Visual Studio Code and have the following settings to enable Pylint and point towards the global Pylint that I've installed with pipx in the .local/ directory.

    {
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    "python.linting.pylintPath": "~/.local/bin/pylint",
    }


    The issue I have is that Pylint import errors are displaying for packages I have installed within the virtual environment, and so I don't know how to link this global Pylint with the local virtual environment in my project so it can recognise the packages. In Visual Studio Code, I have the Python interpreter within the virtual environment selected.

    I'm guessing that I need to provide some setting to change the Python Path that Pylint uses to point to the currently active interpreter within Visual Studio Code. I'm just not sure whether that setting exists, nor of any workaround. Of course, I could just install Pylint as a development dependency inside my project, but I'd rather just make use of the global Pylint if possible. Is there a solution?

    Continue reading...

Compartilhe esta Página