为多个Python项目设置VS Code可以通过以下步骤完成:
{
"python.pythonPath": "/path/to/python",
"python.autoComplete.addBrackets": true,
"python.formatting.provider": "autopep8",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": ["--load-plugins", "pylint_django"],
"python.linting.pylintPath": "/path/to/pylint",
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": ["--ignore=E501"],
"python.linting.flake8Path": "/path/to/flake8",
"python.testing.pytestEnabled": true,
"python.testing.pytestPath": "/path/to/pytest",
"python.testing.unittestEnabled": true,
"python.testing.nosetestsEnabled": true,
"python.testing.cwd": "${workspaceFolder}/tests",
"python.testing.pytestArgs": ["-s", "-v"],
"python.testing.unittestArgs": ["-v"],
"python.testing.nosetestsArgs": ["-v"],
"python.autoComplete.addBrackets": true,
"python.formatting.provider": "autopep8",
"python.formatting.autopep8Args": ["--max-line-length", "120"],
"python.formatting.autopep8Path": "/path/to/autopep8",
"python.formatting.blackPath": "/path/to/black"
}
注意:上述配置中的"/path/to/python"、"/path/to/pylint"、"/path/to/flake8"、"/path/to/pytest"、"/path/to/autopep8"、"/path/to/black"应替换为你本地Python、pylint、flake8、pytest、autopep8、black的路径。
通过以上步骤,你可以为多个Python项目设置不同的VS Code配置,以满足各个项目的需求。
领取专属 10元无门槛券
手把手带您无忧上云