Jupyter Python版本未在笔记本中正确显示

时间:2019-10-07 14:01:29

标签: python jupyter-notebook

我在jupyter中运行python,我以为我在运行Python 3,因为那是我在右上角看到的内容:

enter image description here

但是,在任何单元格中,我都在运行python 2:

#include <iostream>

int main()
{
    int y, x, z;
    y = 3;
    x = 3;
    z = 3;

    if (x == y == z)
    {
        std::cout << "they are equal\n";
    }
    else
    {
        std::cout << "they are not equal\n";
    }
}

现在这是不正确的,因为我已经从jupyter中删除了python 2内核。如何检查笔记本上实际运行的版本?

预先感谢

编辑:我现在看到,即使我有from platform import python_version print(python_version()) ### 2.7.16 import sys sys.executable ### '/usr/local/opt/python@2/bin/python2.7' ,启动新笔记本时该内核仍然可用。但是,在此笔记本中情况并非如此,因为它在顶部显示“ Python 3”

编辑2:找出solution here。遵循这些步骤即可解决此问题。如果有人要添加任何内容,将保留此问题

0 个答案:

没有答案