Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set working directory pemanently in Spyder & RStudio?

Tags:

rstudio

spyder

I have started learning - Machine learning course on Windows OS. Whenever I start a new instance of Spyder 3.2.4(Python 3.6) & RStudio(1.1.383), every time I need to set my current working directory in these IDEs. Is there any way to set them pemanently?

like image 554
WpfBee Avatar asked Dec 21 '17 00:12

WpfBee


People also ask

How do I permanently change the working directory in Python?

In Python, you can get and change (set) the current working directory with os. getcwd() and os. chdir() . The os module is included in the standard library, so no additional installation is required.

How do you set the path on a Spyder?

Press CTRL+SHIFT+ALT+P to open the Preferences window. Within this window, select the Console item on the left, then the Advanced Settings tab. The path to the Python executable will be right there.

How do I change directory in Spyder terminal?

You can change working directory after opening Spyder by typing inside IPython console cd path/to/working/dir .


2 Answers

To set working directory permanently in: 1. Spyder IDE: Tools > Prefeences > Current working directory > the following directory 2. RStudio IDE: Tools > Global Options... > General > Default working directory (when not in a project)

PS: Yes, we need to restart the application in both IDEs to take changes in effect.

like image 141
WpfBee Avatar answered Sep 22 '22 17:09

WpfBee


In Spyder (since version 3.2) you need to go to

Tools > Preferences > Current working directory

and select the option called

the following directory

like image 24
Carlos Cordoba Avatar answered Sep 19 '22 17:09

Carlos Cordoba