[英]VSCode loads the wrong python version in the interactive window
I am trying to use the Interactive window of VSCode, but it loads the wrong version of Python.我正在尝试使用 VSCode 的交互式窗口,但它加载了错误版本的 Python。 I want it to load the version of the virtual environment (shown bottom left), but it defaults to something else.
我希望它加载虚拟环境的版本(显示在左下角),但它默认为其他版本。
I have tried this approach , but I can't simply click the version and change it because it isn't included in the drop down list.我已经尝试过这种方法,但我不能简单地单击版本并更改它,因为它没有包含在下拉列表中。 I have tried adjusting the settings.json file
python.defaultInterpreterPath
but that didn't work (perhaps my syntax is wrong).我试过调整 settings.json 文件
python.defaultInterpreterPath
但这没有用(也许我的语法是错误的)。 I have also made sure that jupyter
is installed in the virtual environment.我还确保在虚拟环境中安装了
jupyter
。
I always run VSCode in the project folder from the command line using code .
我总是使用
code .
从命令行在项目文件夹中运行 VSCode code .
but strangely, something that has worked is running it using code
(without the period).但奇怪的是,一些有用的东西是使用
code
运行它(没有句号)。 This is not a solution however, because the workspace folder is not updated, meaning that when I change the project I'm working on, VSCode opens in previous workspace.然而,这不是解决方案,因为工作区文件夹未更新,这意味着当我更改正在处理的项目时,VSCode 会在之前的工作区中打开。
You can try to delete all the files and folders under this location:您可以尝试删除此位置下的所有文件和文件夹:
C:\Users\${UserName}\AppData\Roaming\Code\User\globalStorage
Others:其他:
The python interpreter of the .ipynb
file was stored in the database located at: .ipynb
文件的 python 解释器存储在位于以下位置的数据库中:
C:\Users\${UserName}\AppData\Roaming\Code\User\workspaceStorage
Such as:如:
If you open a new .ipynb
file in the VSCode which name has not storaged in the database, you will need to select the interpreter.如果在 VSCode 中打开一个新的
.ipynb
文件,该文件的名称尚未存储在数据库中,则需要选择解释器。
It's different from the interactive.它与交互式不同。 You can find, any time you reopen the VSCode, the last time you created interactive will be disappear.
你会发现,每次重新打开 VSCode,上次创建的交互都会消失。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.