Change anaconda ipython main directory

后端 未结 8 1935
误落风尘
误落风尘 2020-12-24 03:07

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 ba

相关标签:
8条回答
  • 2020-12-24 03:51

    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%"
      
    0 讨论(0)
  • 2020-12-24 03:55

    For Windows, edit the shortcut command which starts Jupyter:

    from: ..\Anaconda3\Scripts\jupyter-notebook-script.py %USERPROFILE%

    to : ..\Anaconda3\Scripts\jupyter-notebook-script.py c:\your_project_workspace

    0 讨论(0)
提交回复
热议问题