Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change anaconda ipython main directory

Tags:

anaconda

I've jus installed anaconda and I see that it wants me to save my documents in my documents/python scripts

But I'd rather save everything in my dropbox for easy backups. But I also want to be able to just call scripts by their name and not the whole path. Can this be set?

like image 478
Coolcrab Avatar asked Jun 09 '14 09:06

Coolcrab


3 Answers

Not sure if this is helpful, but as of 11/2/15, Anaconda 2.4.0 moved to Jupyter, which has a different method for changing the default directory

In the command line type:

jupyter notebook --generate-config

Which will create a file named jupyter_notebook_config.py in your jupyter directory (In Windows Users/USERNAME/.jupyter). To change the default directory on startup, locate the line:

c.NotebookApp.notebook_dir = u''

And put your preferred directory in the quotes.

like image 150
Ben Avatar answered Nov 10 '22 14:11

Ben


By default the directory where Jupyter was started is uses as a notebook directory. There are different situations where the IPython notebook directory change is necessary.

  1. To change the default notebook directory for all IPython kernel sessions:

    1.1. Open a command window and execute:

         jupyter notebook --generate-config
    

    This will generate .jupiter/jupyter_notebook_config.py file under your home directory.

    1.2. Find, un-comment and modify the following line in your jupyter_notebook_config.py to point to the desired directory:

    # c.NotebookApp.notebook_dir = ''
    

    Next time you launch IPython, it will open with the notebook directory you specified. For example, you can make D:\Sandbox to be your notebook directory:

     c.NotebookApp.notebook_dir = 'D://Sandbox'
    
  2. You can specify notebook directory per kernel session.

    In my everyday work I use Anaconda and IPython notebooks from different locations, including USB sticks. This makes changing the default directory impractical. I start IPython notebook from the command line, specifying the notebook directory.

        jupyter notebook --notebook-dir="D:\Sandbox"
    

    For frequently used directories, I create a command file in the directory itself. The command launches IPython with current directory as notebook directory. Here is what it looks like in a Windows command file:

       jupyter notebook --notebook-dir="%CD%"
    
like image 35
Ivan Georgiev Avatar answered Nov 10 '22 15:11

Ivan Georgiev


You can right click the Start menu shortcut and change the starting directory.

It's not as easy to change the directory used by the Launcher. I think in principle you could edit some file somewhere to change what directory it uses.

like image 11
asmeurer Avatar answered Nov 10 '22 14:11

asmeurer