无法安装pylint和autoep8

2024-06-16 08:44:59 发布

您现在位置:Python中文网/ 问答频道 /正文

python新手,并尝试在本地计算机上进行设置。我正在尝试安装pylint和autopep8(根据vs code的弹出建议),但当我单击“安装”时,遇到以下错误:

PS D:\Practice\PythonAutomation> & "D:/Visual Studio/Python37_64/python.exe" c:\Users\Andy stav\.vscode\extensions\ms-python.python-2020.4.76186\pythonFiles\pyvsc-run-isolated.py pip install -U pylint --user
D:\Visual Studio\Python37_64\python.exe: can't open file 'c:\Users\Andy': [Errno 2] No such file or directory
PS D:\Practice\PythonAutomation> & "D:/Visual Studio/Python37_64/python.exe" c:\Users\Andy stav \.vscode\extensions\ms-python.python-2020.4.76186\pythonFiles\pyvsc-run-isolated.py pip install -U autopep8 --user
D:\Visual Studio\Python37_64\python.exe: can't open file 'c:\Users\Andy': [Errno 2] No such file or directory
PS D:\Practice\PythonAutomation>

不知道为什么会这样?有人能提供一些建议吗

安迪


Tags: exevscodeusers建议pylintfilepsstudio
3条回答

您可以通过添加额外的反斜杠来解决此问题。请注意,在您的示例中,如何为“Andystav”自动添加空格

D:/Visual Studio/Python37_64/python.exe" c:\\Users\\Andystav\\.vscode\\extensions\\ms-python.python-2020.4.76186\\pythonFiles\\pyvsc-run-isolated.py pip install -U pylint  user

NB: Here we are running pyvsc-run-isolated.py by giving the full path. In that full path the folder name ms-python.python-2020.4.76186 always differ. So remember to change that.

为了能够在VSCode建议之后安装autopep8,我必须运行命令手动将反斜杠(\)更改为斜杠(/

我的终端使用Git Bashshell,请记住您的路径可能不同

之前:

c:/Users/.../.pyenv/pyenv-win/versions/3.8.2/python.exe c:\Users\...\.vscode\extensions\ms-python.python-2021.3.658691958\pythonFiles\pyvsc-run-isolated.py pip install -U autopep8  user

之后:

c:/Users/.../.pyenv/pyenv-win/versions/3.8.2/python.exe  c:/Users/.../.vscode/extensions/ms-python.python-2021.3.658691958/pythonFiles/pyvsc-run-isolated.py pip install -U autopep8  user

不幸的是,您遇到了上一个版本中出现的bug。我们正在https://github.com/microsoft/vscode-python/issues/11449跟踪它

相关问题 更多 >