How to set working directory for ipython notebook?

已回答

My project structure is as follows:

~/Edu/ML/ -- project root

. . .pyenv -- venv

. . some_course/ -- a course root, there're many of them

. . . work/ -- source root for the course

. . . . blablabla.ipynb -- a notebook i'm intened to work with

 

The notebook contains statements like `open("some_file")` that suppose files to be found in current working directory. But current working directory is set to project root.

How do i change working directory for this notebook to `~/Edu/ML/acourse/work` ?

 

2

You can set working directory for your notebook in Settings(Preferences on OS X)| Languages&Frameworks| Jupyter Notebook| Working Directory. Please let me know if you have any problems with it.

-1
Avatar
Permanently deleted user

Yes! That works!

However, it seems to be setting not for a notebook but for all notebooks in project.

0

Yes, it's true because it's expected that all your notebooks have one working directory in the current project. If you miss an option to have different working directories please feel free to file an issue to Pycharm issue tracker: https://youtrack.jetbrains.com/issues/PY.

0
Avatar
Permanently deleted user

Hello, is this only an answer for the PyCharm Professional version? I have the Community version and I do not seem to find the option to set the WD under Languages&Frameworks > Jupyter Notebook.

0
Avatar
Permanently deleted user

No longer valid as of Pycharm Professional 2018.3.  There is no setting for working directory in that dialog.

2

Yes - Oct 9 2019 also does not have this setting 2019.2 Pro

 

 

 

0
Avatar
Permanently deleted user

Same problem here, I can't find where the working dir can be set.

 

Support was removed here: https://youtrack.jetbrains.com/issue/PY-32934

Adding it back is being considered here: https://youtrack.jetbrains.com/issue/PY-35329 . Upvote if you're interested!

0

请先登录再写评论。