[英]Adapt file path to UNIX- or Windows-style related to VS Code setting "python.terminal.activateEnvironment"
In the .vscode/settings.json
of my current workspace, I have:在我当前工作区的
.vscode/settings.json
中,我有:
"python.terminal.activateEnvironment": true
It works upon opening an integrated PowerShell
terminal, but both MINGW64 bash
and WSL
fail like so:它在打开集成的
PowerShell
终端时起作用,但MINGW64 bash
和WSL
都失败了,如下所示:
username@hd1pcms0347:/mnt/c/Users/username/Projects/projname$ source c:/Users/username/Projects/projname-venv/Scripts/activate
-bash: c:/Users/username/Projects/projname-venv/Scripts/activate: No such file or directory
Of course, I can manually adapt the file path from当然,我可以手动调整文件路径
c:/Users/username/Projects/projname-venv/Scripts/activate
to到
/c/Users/username/Projects/projname-venv/Scripts/activate
for the MINGW64 bash
shell, or对于
MINGW64 bash
shell,或
/mnt/c/Users/username/Projects/projname-venv/Scripts/activate
for the WSL
shell, to make it work.对于
WSL
shell,让它工作。 Yet, this is suboptimal as it will always require my manual intervention .然而,这是次优的,因为它总是需要我的手动干预。
How can I achieve that this file path will have automatically either UNIX- or Windows-style depending on the terminal-type I open?我怎样才能使这个文件路径根据我打开的终端类型自动具有 UNIX 或 Windows 风格?
Edit: add screenshot of integrated terminal in VS Code编辑:在 VS Code 中添加集成终端的屏幕截图
You should reselect the python interpreter before you create a new terminal using the remote server.在使用远程服务器创建新终端之前,您应该重新选择 python 解释器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.