英文:
How to pass option to python when I'm running a jupyter notebook on VS Code
问题
I've created a virtual environment using venv
and I'm using such an environment in Visual Studio Code to run a Jupyter notebook.
Now, my code stops running, and from the log, I can read 2 warnings: one of which is
warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Let's suppose I want to pass -Xfrozen_modules=off
to Python to see what happens. How can I do it? I mean, I'm not running Python from the command line; I'm just pressing Shift+Enter in Visual Studio Code to execute the code cells of my notebook. How can I pass options to Python in Visual Studio Code?
英文:
I've created a virtual environment using venv
and I'm using such environment in Visual Studio Code to run a jupyter notebook.
Now, my code stops running and from the log I can read 2 warnings: one of which is
warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Let's suppose I want to pass -Xfrozen_modules=off
to python to see what happens, how can I do it? I mean: I'm not running python from command line, I'm just pressing Shift+Enter in Visual Studio Code to execute the code cells of my notebook; how can I pass option to python in Visual Studio Code?
答案1
得分: 0
你可以将 "jupyter.jupyterCommandLineArguments": ["-Xfrozen_modules=off"],
添加到你的工作区的 .vscode/settings.json 中吗?
英文:
Can you not just put "jupyter.jupyterCommandLineArguments": ["-Xfrozen_modules=off"],
in your workspace's .vscode/settings.json?
答案2
得分: 0
找到虚拟环境文件夹下 Jupyter 内核的 kernel.json 文件。应该位于以下路径
...\venv\share\jupyter\kernels\python3\kernel.json
打开 kernel.json 文件,在 "argv"
中添加 -Xfrozen_modules=off
参数。
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论