当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当前回答
运行ipython之前:
将目录更改为您的首选目录 运行ipython
运行ipython后:
使用%cd /输入/your/ preferred /path/here/ 使用%pwd检查当前目录
其他回答
在Windows上的iPython Notebook中,这对我来说很有效:
cd d:\folder\
This might help someone who doesn't want to change config file. If you are on Windows/ using Anaconda3, go to Win Start ->Search for Jupyter Notebook(env). Click on it and the Jupyter opens up. On Jupyter webpage, on right hand side go to New -> Terminal and the terminal window opens up. In this terminal windows change the directory to the working directory, using cd command. Example: cd "c:\User\<user-name>\workingdir". Now in the same terminal window type Jupyter-notebook, this will open Jupyter with the working directory we used in cd command above.
import sys
sys.path.append('C:/')
找到你的ipython二进制文件。如果你使用anaconda在mac上安装ipython-notebook,它很可能会在/Users/[name]/anaconda/bin/目录下
在那个目录下,而不是启动你的笔记本
./ipython notebook
添加——notebook-dir=<unicode>选项。
./ipython notebook --notebook-dir=u'../rel/path/to/your/python-notebooks'
我在ipython bin目录中使用bashscript启动我的笔记本:
DIR=$(dirname $0)
$DIR/ipython notebook --notebook-dir=u'../rel/path/to/your/python-notebooks'
注意-到notebook目录的路径是相对于ipython bin目录的。
我有32位和64位的python和使用WinPython的ipython,我想要32位和64位的版本指向ipython笔记本的相同工作目录。
我按照上面的建议在这里,我仍然无法让我的设置工作。
以下是我所做的——以防有人需要:
看起来Ipython notebook使用了来自C:\pythonPath\winpythonPath\settings\.ipython\profile_default的配置
尽管ipython locate返回C:\users\Username\.ipython
因此,修改ipython_notebook_config.py文件并没有改变我的工作目录。
另外,ipython profile_create没有在C:\pythonPath\winpythonPath\settings\.ipython\profile_default中创建所需的python文件
我相信有更好的方法,但为了快速解决这个问题,我从C:\users\Username\复制了编辑好的python文件。C:\pythonPath\winpythonPath\settings\.ipython\profile_default
现在(终于)ipython notebook 64位运行并为我提供正确的工作目录
注意在Windows上,我对以下语法没有问题:
c.NotebookApp.notebook_dir = u'C:/Users/Path_to_working_directory'