问题
I'm trying to use jupyter notebook from PyCharm 2016.1. I open a previously created iPython notebook, click in a cell with code, and run it. I get prompted to start jupyter notebook at the default url and click OK. Here are the error messages from the Run window:
[C 13:04:23.979 NotebookApp] Bad config encountered during initialization:
The Jupyter HTML Notebook.
[C 13:04:23.979 NotebookApp] No such notebook dir: 'C:\\Users\\cb4\\Documents\\python'
iPython Notebook is enabled in PyCharm with the default url.
回答1:
Jupyter keeps configuration info in the jupyter_notebook_config.py
file. You can find it in C:\Users\<user>\.jupyter
on Windows or ~\.jupyter
on linux. Modify the c.NotebookApp.notebook_dir
entry to the location where you keep your notebooks. You can also use the command line to set it:
jupyter-notebook --notebook-dir=<path>
Enclose the <path>
in double quotes on Windows if there is a space in the path name.
If you had iPython installed before upgrading to jupyter, then the jupyter migration process used the settings from your old iPython config file. Maybe it's been a long time since you modified iPython and that is why you are seeing unexpected startup or running behavior from jupyter.
Also, this jupyter command may help troubleshoot directory/path problems:
jupyter --paths
回答2:
Just had the same problem and resolved it with the following command:
jupyter notebook --generate-config
More infos are here: http://jupyter-notebook.readthedocs.io/en/stable/config.html
It prompted me to replace my current config with the default config. Thus, if you're fine getting rid of your current config, this is an easy option.
回答3:
I solved this issue by:
opening cmd as admin
type in :
jupyter notebook --config=/home/john/mystuff/jupyter_notebook_config.json
Note that: before running above script make sure , Anaconda and Jupyter Lab must be uninstalled
- Delete all files in C:/ drive
- Then install re-install the latest Python3 , and add/set the Environment path correctly , and isuggested make Pyhon in the main root folder of as C:/Python not c:/User/.../Python , however u need to install Jupyter notebook usin : pip install Jupyter notebook **sometimes u need to install get-pip.py in order to use pip
- There is sometimes that the jupyter_notebook_config.py is missing To create a jupyter_notebook_config.py file, after installing the python ,
- you can use the following command line:
jupyter notebook --generate-config
来源:https://stackoverflow.com/questions/36434496/using-jupyter-notebook-in-pycharm-no-such-notebook-dir