settings.json
"python.pythonPath": "/Users/brandonwie/opt/anaconda3/bin/python",
"[python]": {
"editor.tabSize": 4
},
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.pylintEnabled": false,
"python.formatting.blackPath": "/Users/brandonwie/opt/anaconda3/bin/black",
"python.showStartPage": false,
"python.formatting.provider": "black",
"python.analysis.typeCheckingMode": "basic",
I'm using VSCode
, I've installed anaconda3
to try conda
environment, but then black
formatter stopped working right after I start using conda Python(I don't know it's because of conda Python). So I installed black with (conda) pip, but nothing is working..
Initially, the blackPath
in setting.json
was set to /usr/local/bin/black
. The black formatter was working flawlessly until I install and set up VSCode with conda, there was a pop up at the right bottom when I saved a file "cannot find black" something like that.(because of 'format on save') I've tried changing the path to /usr/...
and /Users/
back and forth, but doesn't work as well.
How can I solve this issue?
You don't need to specify the blackpath in Settings.json.
Run pip uninstall black
to delete black in current activated conda environment;
In Settings.json, set "python.formatting.provider": "black",
Turn to.py file then press Ctrl+S to save it. At the same time, there will be an notification popping up:
After its installation, you can use black to format your file successfully.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.