系统:
- Windows 10
- ipykernel 5.0.0
- ipython 7.0.1
- jupyter 1.0.0
- Python 3.6.7rc1
- TensorFlow 1.9
[ √ ] 需要特别说明的是,我的win10下python安装是直接安装的,不是anaconda环境
运行前提: python环境依赖安装成功!
在Win10系统下,cmd终端运行
C:\Users\xxx> jupyter notebook
跳转到浏览器,打开后缀为.ipynb的文件,右上角总是显示
kernel starting, please wait
或者,点击kernel选项下的restart等选项,总是无法正常启动
现列出查询到的解决办法,对我没有用处,也许对你有所帮助,仅供参考!
jupyter notebook
{
"argv": [
"python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python 3",
"language": "python"
}
按照此方法的修改方法,应该修改为:
{
"argv": [
"D:\\Program Files\\Anaconda3\\envs\\tensorflow\\python.exe",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python 3",
"language": "python"
}
但是,我修改以后没有任何作用,问题依然存在,而且最终正常运行以后查看kerner.jason文件也没有做任何修改,所以推测是此博主在python安装配置过程出现了问题,或者系统中安装了多个python版本,因此需要在jupyter notebook中特别指定python路径!
anaconda prompt
conda uninstall jupyter notebook
conda uninstall jupyter notebook
ipython kernel install --user
github提供的完整方法是:
conda create -n py36 python=3.6 # step 1
source activate py36 # step 2
conda install notebook ipykernel # step 3
ipython kernel install --user # step 4
conda create -n py27 python=2.7 # step 1
source activate py27 # step 2
conda install notebook ipykernel # step 3
ipython kernel install --user # step 4
作为一个较少使用jupyter notebook的老哥(其实是懒的用,喜欢在项目下加个test.py直接撸代码),鼓捣一会才发现,出现的问题都是会在win终端下显示出来的!(我勒个去,傻笑一个)。
先列出来按照网上的方法安装时出现的问题:
这个时候,已经出现问题所在了,最后一行:
ModuleNotFoundError: No module named 'prompt_toolkit.formatted_text'
我一开始并没有注意到这行,如果你看到了这里,你可以试着查看你的cmd终端显示的什么错误,而不是直接按照网上的说法复制粘贴执行代码。
我的jupyter notebook总是运行显示正在启动或重启kernel无效,正是由于这个问题导致的,解决方法这里有说:
github上的prompt_toolkit错误解决方法
问题是没有安装prompt_toolkit,那么安装吧,在cmd下pip安装就好了:
pip install --upgrade prompt-toolkit==2.0.4
安装完以后还是有问题,继续安装:
pip install Flask-WTF
安装完这俩以后,运行jupyter notebook竟然直接好了,看来不是kernel问题,只是自己电脑环境依赖没有安装完整。
要善于发现属于自己的问题,网上信息杂乱,不可盲目跟风!!