我的Jupyter笔记本电脑安装了python 2内核。我不明白为什么。我可能在安装的时候搞砸了。我已经安装了python 3。我怎么能把它加到木星上? 下面是默认的Jupyter使用python3 -m install Jupyter安装并在浏览器中使用Jupyter notebook打开的截图:
当前回答
使用Python2获得ipython笔记本(在Windows7上) 用pip install -U Jupyter升级到Jupyter 安装Python3 使用pip3 install Jupyter再次安装Jupyter 使用ipython3 kernelspec install-self安装Python3内核 我终于有两个工作的玉米粒了。
其他回答
Here's a Windows/non command line method I found, which worked for me: Find the folder where the kernel files are stored (on my machine - C:\ProgramData\jupyter\kernels - note that ProgramData is a hidden folder), create a copy of the existing kernel's folder, change the name and edit the json file within to point to the new kernel's directory. In this json you can also edit the kernel name that is displayed in ipython (e.g. instead of just python 2 you can specify 2.7.9 if you need to further distinguish for some reason).
添加内核意味着你想要使用Jupyter Notebook和列表中没有显示的python版本。
简单的方法-使用所需的python版本启动笔记本,假设我安装了python3.7,然后从终端(cmd)使用以下命令来运行笔记本:
python3.7 -m notebook
有时它会使用别名py, py3.7, python来代替python3.7。
我在python-2中得到了同样的错误。我想运行python-2 jupyter笔记本会话,但默认情况下,我得到了python-3。所以最简单的工作是为python-2打开Anaconda终端并键入“jupyter notebook”,它将毫无问题地启动jupyter-notebook会话。同样,也可以在python-3中尝试
最短最好的解决方案
conda create --name py3-ml python=3.6
conda install ipykernel
source activate py3-ml # or conda activate py3-ml
python -m ipykernel install --user --name py3-ml
我有Python 2.7,并希望能够在Jupyter内部切换到Python 3。
这些步骤在Windows Anaconda命令提示符上为我工作:
conda update conda
conda create -n py33 python=3.3 anaconda
activate py33
ipython kernelspec install-self
deactivate
现在,在使用Python2.7的常用命令打开ipython notebook之后,在创建新notebook时也可以使用Python3.3。
推荐文章
- 当试图运行Python脚本时,“ImportError:没有命名模块”
- 如何阅读一个。xlsx文件使用熊猫库在iPython?
- 检查pandas数据框架索引中是否存在值
- Ipython笔记本清除单元格输出代码
- tqdm在Jupyter笔记本重复打印新的进度条
- 折叠单元在jupyter笔记本
- 如何知道哪个Python在Jupyter笔记本上运行?
- 使用Python 3在Jupyter Notebook中使用相对导入从位于另一个目录中的模块导入本地函数
- 如何嵌入HTML到IPython输出?
- Python和IPython的区别是什么?
- 如何从终端运行。ipynb Jupyter Notebook ?
- 移除jupyter笔记本上的内核
- 如何使用列的格式字符串显示浮动的熊猫数据帧?
- 使用Python 2。3. Python。IPython Notebook中的x
- 如何加载/编辑/运行/保存文本文件(.py)到IPython笔记本细胞?