相关疑难解决方法(0)

VSCode - 如何设置调试的工作目录

我开始使用vscode for Python.我有一个简单的测试程序.我想在调试下运行它,我需要设置运行的工作目录.

我是怎么做的?

python visual-studio-code

34
推荐指数
7
解决办法
3万
查看次数

如何在VScode中设置jupyter的运行文件路径?

当我在 VScode 中使用 jupyter 扩展并在 jupyter 中运行一行代码以使用相对路径保存文件时?我在另一个文件中找到了文件(iris_tree.dot)。就像我在另一个文件路径中调试/运行代码一样。如何设置 jupyter runner 的正确路径?

#%%
from sklearn.tree import export_graphviz
export_graphviz(
tree_clf,
out_file="iris_tree.dot",
feature_names=iris.feature_names[2:],
class_names=iris.target_names,
rounded=True,
filled=True
)
Run Code Online (Sandbox Code Playgroud)

python jupyter visual-studio-code

8
推荐指数
3
解决办法
9643
查看次数

VSCode 中的 Python:每次都将工作目录设置为 python 文件的路径

所以我想从 Spyder 迁移到 VSCode,我遇到了这个问题,我无法访问数据集,因为我的工作目录与数据集的路径不同。

launch.json不是为我自动生成的,因为我没有调试任何东西(我试过这个)。

如何在 VSCode 中将工作目录设置为始终是我要运行的 Python 文件的目录?(如果这是不好的做法,你能告诉我一个易于使用的配置吗?)我想为 VSCode 的 IPython 终端设置它。

python working-directory visual-studio-code

6
推荐指数
6
解决办法
8976
查看次数

Wrong current working directory when running python code and jupyter extension in vscode

I am trying to run python code using the jupyter extension in vscode here

I have a workspace open at this location /Users/user/Documents/ When I try and run the following code in a file called test.py in a child directory, the current working directory is set at the workspace level rather than the file. Is it possible to change a setting to use the cwd of the file, rather than the workspace? I cannot find one in settings.json and the …

python jupyter visual-studio-code

5
推荐指数
1
解决办法
4826
查看次数