在jupyter笔记本中,我使用python3内核,但我键入sys.version,它显示 2.7.2 ...,我期望3.x
import sys, platform
sys.version
'2.7.12 (default, Nov 12 2018, 14:36:49) \n[GCC 5.4.0 20160609]'
platform.python_version()
'2.7.12'
我希望输出为3.x,但实际输出为2.7
答案 0 :(得分:0)
在终端中键入以下内容以检查您是否确实以正确的方式设置了内核,例如我的节目如下
schlator@lenovo:~$ jupyter kernelspec list
Available kernels:
ir /home/schlator/.local/share/jupyter/kernels/ir
julia-1.0 /home/schlator/.local/share/jupyter/kernels/julia-1.0
python2 /home/schlator/.local/share/jupyter/kernels/python2
python3 /home/schlator/anaconda3/share/jupyter/kernels/python3
如果发现意外情况,则可能必须安装python3内核。