I have a problem recently :vscode Upper terminal python Version and xshell On the terminal python Version does not correspond to .
I'm going to use vscode Connect to the server remotely to debug the code , When the terminal enters the virtual environment, it is found that python yes Linux default python edition (2.7), instead of anaconda Of python edition ( It's been installed before anaconda). Enter the command which python
It also shows liunx default python route .
At this point I use xshell Connect to server , Enter the command which python
It is shown that anaconda Of python route , Enter the command python
It also shows anaconda default python edition (3.7.6).
Next, I go to a section called tracking
Virtual environment for (python Version is 3.6.2) in , Find out vscode On the terminal python Also still linux default python(2.7)
And in the xshell Entry in terminal tracking
The virtual environment shows python Version is normal
Later I saw such a link on the Internet https://blog.csdn.net/weixin_43659913/article/details/103830210. This link applies to Macos System , Not applicable to liunx System . Later I copied this link , stay setting.json
The following statement is added to the file :
"terminal.integrated.env.linux": {
"PATH": "" }
The result did not solve the problem
Personally, I think there is no problem on the server side , Otherwise, use xshell Terminal displayed python The version is also wrong . Should be vscode Set up questions , But I have no idea how to change myself .