[PYTHON] Prepare VSCode's pyhton environment (pyenv) (MacOS, flake8 + autopep8)

environment

--Pyenv usually uses 3 series --Package management: pip --Use flake8 instead of pylint for Linter. It is used in combination with autopep8.

$ pyenv global 3.7.3

It is assumed that pyenv has been set. By the way, python installed in pyenv and python on the system side installed by brew etc. (the one installed by brew install python) are different, so I think you should be aware of that.

Make VS Code recognize python correctly

On the terminal side, even if the python installed in pyenv is set to global, there is a problem that when it is opened on the VSCode side, it refers to the python on the system side. Add the python path of pyenv displayed by $ which python to settings.json.

"python.pythonPath": "/Users/User name/.pyenv/shims/python",

Linter settings

I set it referring to this article. In the original article, "" is not included in "autopep8", but in my environment, an error occurred unless "" was included.

-[https://qiita.com/psychoroid/items/2c2acc06c900d2c0c8cb Introduce flake8 instead of pylint in VS Code Python development environment and set automatic formatting --Qiita]

Recommended Posts

Prepare VSCode's pyhton environment (pyenv) (MacOS, flake8 + autopep8)
Run OpenVino on macOS and pyenv and pipenv environment
[Python] Django environment construction (pyenv + pyenv-virtualenv + Anaconda) for macOS
Build a Python development environment using pyenv on MacOS