简体   繁体   English

Jupyter Notebook 中的 Python 3 不起作用

[英]Python 3 in Jupyter Notebook doesn't work

I want to use Jupyter Notebook with Python 3 (which according to my terminal it's the 3.7.4 version) but when I open Jupyter Notebook it shows me "Python 2" in the corner.我想将 Jupyter Notebook 与 Python 3 一起使用(根据我的终端,它是 3.7.4 版本)但是当我打开 Jupyter Notebook 时,它会在角落里显示“Python 2”。
I first installed pip and after numerous tries someone told me "do it with conda and your problem will be fixed" and I did, but the problem is still there.我首先安装了 pip,经过多次尝试,有人告诉我“用 conda 安装,您的问题将得到解决”,我确实安装了,但问题仍然存在。

From what I have look in internet and what my profesor and friends told me, it should be working.从我在互联网上看到的以及我的教授和朋友告诉我的情况来看,它应该有效。

Any suggestions?有什么建议?

PS: I even read some questions asked here but the answers didn't work for me. PS:我什至阅读了这里提出的一些问题,但答案对我不起作用。

EDIT: Following @Fabioconcina suggestiong, maybe helpful to show what I obtain by using jupyter --paths in the terminal.编辑:按照@Fabioconcina 的建议,可能有助于显示我通过在终端中使用jupyter --paths获得的内容。

So I got the following:所以我得到了以下信息:

screen屏幕

All your suggestions were right.你所有的建议都是对的。 What I had to do was to open a new file.我必须做的是打开一个文件。 In all yours suggestions I was opening the first file I was working.在你的所有建议中,我打开了我正在工作的第一个文件。 Thank you all for your help.谢谢大家的帮助。

if you have installed anaconda you can update your python by using conda.如果你已经安装了 anaconda,你可以使用 conda 更新你的 python。 Please run your terminal or command prombt as administrator, and just use any of the method given below请以管理员身份运行您的终端或命令提示符,然后使用下面给出的任何一种方法

   1.   conda install python=$pythonversion$ 

or if you just need any updated version of python或者如果您只需要任何更新版本的python

   2. conda update python

or或者

3. conda create --name py374 python=3.7.4 --channel conda-forge

Using the where command in windows (and, I think which in linux/mac) can help diagnose this problem.在 windows 中使用where命令(我认为在 linux/mac 中使用which )可以帮助诊断这个问题。 For instance, if I run例如,如果我运行

> where python

on my computer, I get the following response在我的电脑上,我得到以下响应

C:\ProgramData\Anaconda3\python.exe

I can use this to track down what my computer wants to run if I type in other commands, for instance:如果我输入其他命令,我可以使用它来跟踪我的计算机想要运行的内容,例如:

> where jupyter
C:\ProgramData\Anaconda3\Scripts\jupyter.exe

will help me sus out what particular executable is being run when I type a command.当我键入命令时,将帮助我确定正在运行的特定可执行文件。


It is worth investigating what version of ipython you have installed as well, since that will affect what python kernels you can support.值得调查您安装的 ipython 版本,因为这会影响您可以支持的 python 内核。 The ipython documentation notes that ipython 文档指出

IPython 6.0 stopped support for Python 2, so installing IPython on Python 2 will give you an older version (5.x series). IPython 6.0 停止支持 Python 2,因此在 Python 2 上安装 IPython 将为您提供旧版本(5.x 系列)。

which suggests to me that you're running a pre-6.0 version.这向我表明您正在运行 6.0 之前的版本。 You can use conda list to list out the versions of everything you have installed.您可以使用conda list列出已安装的所有版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM