M
M
Maxim Zubenko2019-12-06 08:49:38
Python
Maxim Zubenko, 2019-12-06 08:49:38

How do I make Visual Studio Code not put anything extra in my Python virtualenv, but still have the lintener and formatting work?

All the best.
For large projects (Django) I actively use PyCharm on Ubuntu.
But at the same time I need quick projects under Win10. (parsers, collators, testers and other small fast projects).
For this I want to use Visual Studio Code.
By habit, any project begins with the installation of a virtual environment.
VS Code with virtualenv works fine (terminal, debug)
I installed the python package. I thought he could do anything out of the box. And fig.
In order for the code analyzer and formatter to work, a window pops up, they say, install PyLint and autopep8, for example.
And by clicking on the installation, this weirdo does not install itself somewhere behind the scenes, but me in virtualenv. Just some kind of game. I don't know how to win
What extensions to install to replace the "pollution" of the virtual environment I can't imagine.
Well, how so? A crowd of people use it and that no one noticed that vs code is getting into the virtual environment of the project?
That's all in the editor is good, but it's impossible to use it, because the usual functions (which I thought would be out of the box) are missing, and in order to use them, you need to spoil the working virtual environment.
Maybe I don't know something. Tell.
Sincerely.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Diatomiccoder, 2019-12-06
@Diatomiccoder

Not the most elegant solution, but... To begin with, don't click on the install button offered by the editor. If you install packages "globally", not in a local virtualenv, then vs code will have to pick them up.
Those. you need to install the necessary packages through the terminal without entering any virtual environment (pip install pep8 pylint)
UPD : Just adding packages globally is not enough, you also need to let the virtual environment interpreter know that we want to use them (global packages). This can be achieved either with the --system-site-packages argument when installing the virt.environment, or in the pyvenv.cfg file, set the include-system-site-packages parameter to true
5deb707490bdc145539512.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question