程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了在 Jupyter notebook 中获取 python大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决在 Jupyter notebook 中获取 python?

开发过程中遇到在 Jupyter notebook 中获取 python的问题如何解决?下面主要结合日常开发的经验,给出你关于在 Jupyter notebook 中获取 python的解决方法建议,希望对你解决在 Jupyter notebook 中获取 python有所启发或帮助;

我已经在我的电脑上安装了 python3。 当我开始一个新的 Jupyter 笔记本时,我选择了 python 3 但现在在笔记本上,它说它不存在

当我运行这个时: 打印(python_version())

我收到此错误:

nameError TraceBACk(最近一次调用最后一次) 在 ----> 1 打印(python_version())

nameError: name 'python_version' 未定义

解决方法

python_version() 函数来自 platform 模块;所以你必须先导入它:

import platform
print(platform.python_version())

另一种检查python版本的方法是sys模块:

import sys
print(sys.version)

大佬总结

以上是大佬教程为你收集整理的在 Jupyter notebook 中获取 python全部内容,希望文章能够帮你解决在 Jupyter notebook 中获取 python所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。