Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the running file path of jupyter in VScode?

When I use the jupyter extension in VScode and run a line of code in jupyter to save a file using relative path,I found the file(iris_tree.dot) in another file. It's just like i debug/run the code in another file path. How can I set the correct path of the 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
)
like image 763
YANGSU LIU Avatar asked Apr 03 '19 08:04

YANGSU LIU


People also ask

How do you specify a file path in Jupyter Notebook?

Right-click on a file or directory and select “Copy Shareable Link” to copy a URL that can be used to open JupyterLab with that file or directory open. Right-click on a file or directory and select “Copy Path” to copy the filesystem relative path.

How do I run a Jupyter cell in VS Code?

Once you have a Notebook, you can run a code cell using the Run icon to the left of the cell and the output will appear directly below the code cell. You can also use keyboard shortcuts to run code.

How do I change the interpreter path in python VS Code?

To do so, open the Command Palette (Ctrl+Shift+P) and enter Preferences: Open User Settings. Then set python.condaPath , which is in the Python extension section of User Settings, with the appropriate path.


1 Answers

Just update the value of "Notebook File Root" to ${fileDirname}.

enter image description here

like image 175
Mike Stop Continues Avatar answered Oct 10 '22 11:10

Mike Stop Continues