当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当我打开Jupyter笔记本(以前是IPython)时,它默认为c:\ users \ username
我如何将其更改为另一个位置?
当前回答
如果您在Windows中安装了最新版本的Python,则上层解决方案可能不适用于您。我已经安装了Python 3.6.0:: Anaconda 4.3.0(64位),我想更改名为Jupyter的iPython Notebook的工作目录,这就是它为我工作的方式。
步骤1:打开CMD并输入以下命令。
步骤1:CMD
步骤2:现在已经在.jupyter文件夹中生成了一个文件。对我来说,它是c:\用户\管理。jupyter。在那里您将找到一个名为jupyter_notebook_config.py的文件。右键单击并编辑它。添加以下一行并设置工作目录的路径。 在“I:\STUDY\Y2-Trimester-1\Modern Data Science”中设置自己的工作目录
我们做完了。现在你可以重新启动Jupyter Notebook了。希望这对你有用。谢谢
其他回答
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.
对上面的Windows技巧的一个更简单的修改-不需要硬编码目录。
A)创建一个包含以下内容的批处理文件: 注意:批处理文件是一个简单的文本文件,其中包含可以执行的命令 在CMD窗口中运行。它必须有一个'.bat'扩展名,因此… 你需要禁用隐藏已知类型扩展名的文件夹设置)
rem -- start_ipython_notebook_here.bat ---
dir
ipython notebook
pause
B)复制并粘贴批处理文件到任何你想要启动笔记本服务器的文件夹。
(确保它是一个你有权限编辑的文件夹。“C:\”不是一个好的选择。)
C)在Windows资源管理器中双击批处理文件。
笔记本服务器应该像往常一样启动。
只需遵循官方网站上的指南,也复制在下面。对于第一步,而不是复制启动器,您只需转到开始菜单并右键单击打开位置。
Copy the Jupyter Notebook launcher from the menu to the desktop. Right click on the new launcher and change the “Start in” field by pasting the full path of the folder which will contain all the notebooks. Double-click on the Jupyter Notebook desktop launcher (icon shows [IPy]) to start the Jupyter Notebook App, which will open in a new browser window (or tab). Note also that a secondary terminal window (used only for error logging and for shut down) will be also opened. If only the terminal starts, try opening this address with your browser: http://localhost:8888/.
如果你在linux中使用ipython,那么按照以下步骤: ! cd / directory_name / 您可以尝试在您的linux终端中工作的所有命令。 ! vi file_name.py
只需在linux命令之前指定感叹号(!)符号。
Jupyter笔记本——help-all可能会有帮助:
--notebook-dir=<Unicode> (NotebookManager.notebook_dir)
Default: u'/Users/me/ipynbs'
The directory to use for notebooks.
例如:
jupyter notebook --notebook-dir=/Users/yourname/folder1/folder2/
如果需要,你当然可以在你的配置文件中设置它,你可能需要在Windows中转义反斜杠。
注意,这将覆盖您在jupyter_notebook_config.py文件中设置的任何路径。(在这里你可以设置一个变量c.NotebookApp。Notebook_dir将是您的默认启动位置。)