Opened a ticket with AutoPep8, but when I installed the autopep8 extension, it doesn't seem to find the module. When I change the config to tell it where it is a format doesn't do anything. Formating in terminal does however. Any ideas? https://github.com/hhatto/autopep8/issues/349#issuecomment-335662565
Asked
Active
Viewed 4.2k times
9
-
Can you show a picture of what is happening? What are you wanting from the formatting? – ifconfig Oct 11 '17 at 04:15
-
Have you tried the [default Python extension](https://marketplace.visualstudio.com/items?itemName=donjayamanne.python) yet? – ifconfig Oct 12 '17 at 15:19
-
Got a 404 on that link – Dan Quackenbush Feb 12 '18 at 23:36
-
Updated link: https://marketplace.visualstudio.com/items?itemName=ms-python.python – ifconfig Feb 13 '18 at 03:22
-
I installed that and I get the same result. Also it warns that its not a recommended interpretor. – Dan Quackenbush Feb 15 '18 at 02:07
-
Could it be that you are using a different python installation on the command line vs in VS Code? – John Vandenberg May 05 '18 at 11:15
-
I’m using the “python” extension as linked above. I also have python normal installation on my computer. – Dan Quackenbush May 05 '18 at 14:34
3 Answers
10
Install the below python packages for Python Code Format supporting in Windows
pip install autopep8
pip install pylint
Once you have successfully installed the packages, Open the code in vs code -> Press Ctrl + A and Ctrl + K, it will format the code.

Dhandapani Sudhakar
- 305
- 1
- 4
- 16
6
autopep8 is listed as a requirement. On mac, using brew, you can install it as follows:
brew install autopep8

Sybrand
- 766
- 1
- 6
- 6
-
The other [answer](https://stackoverflow.com/a/60880116/1705829) recommends `pylint`, is it needed for Mac to autoformat code? – Timo Sep 22 '22 at 06:55
2
you should try black.
pip install black
and then open the auto format option in vscode when save and modify the python format provider to black in vscode settings. enjoy the black.

jiakai
- 31
- 4