I'm a new Python programmer using the Mac version of VS Code 1.45.1 to create a Django project. I have the Python and Django extensions installed. Every time I save a Django file, Code pops up this window:
Formatter autopep8 is not installed. Install?
Source: Python (Extension) [Yes] [Use black] [Use yapf]
I keep clicking the "Yes" button to install the autopep8 extension but this message keeps popping up nevertheless. Is there some trick to configuring VS Code so that this extension will be installed permanently and I stop getting this error?
If you're using eclipse + PyDev you can simply activate autopep8 from PyDev's settings: Windows -> Preferences -> type 'autopep8' in the search filter. Show activity on this post. There are many. IDEs usually have some formatting capability built in.
autopep8 automatically formats Python code to conform to the PEP 8 style guide. It uses the pycodestyle utility to determine what parts of the code needs to be formatted. autopep8 is capable of fixing most of the formatting issues that can be reported by pycodestyle.
You will receive this prompt if
"formatOnSave"
turned on as a settingSo the options are:
My guess is there's an installation failure because you are using a globally installed interpreter and you're not allowed to install where pip wants to put autopep8.
I have also encountered this problem in my computer with Ubuntu 18.04. It turns out that the python extension need some settings. My solution is:
pip install pep8
pip install --upgrade autopep8
or
"python.formatting.provider": "autopep8"
windows 10: on vscode terminal:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With