如何使Jupyter Notebook在系统变量中使用PYTHONPATH而不直接入侵sys.path? [英] How to make Jupyter notebook use PYTHONPATH in system variables without hacking sys.path directly?

查看:351
本文介绍了如何使Jupyter Notebook在系统变量中使用PYTHONPATH而不直接入侵sys.path?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与该问题相同的问题 sys.path在Jupyter和Python中有所不同-如何在Jupyter中导入自己的模块? .在纯Python中,它将系统环境变量PYTHONPATH附加到sys.path中,但是Jupyter notebook没有,因此我无法导入自己的模块.

Same problem as in this question sys.path different in Jupyter and Python - how to import own modules in Jupyter?. In pure Python, it prepends my system environment variable PYTHONPATH to sys.path but Jupyter notebook doesn't, so I can't import my own module.

在SO上也有许多类似的问题,解决方案是直接在脚本中操纵sys.path.

There are many similar questions asked on SO, and the solution is to directly manipulate sys.path in the script.

有没有办法让Jupyter笔记本使用我的系统PYTHONPATH变量,就像在纯python中一样?

Is there a way to make Jupyter notebook use my system PYTHONPATH variable, as in pure python?

推荐答案

Jupyter使用其自己的 JUPYTER_PATH 环境变量.

Jupyter uses its own JUPYTER_PATH environment variable.

这篇关于如何使Jupyter Notebook在系统变量中使用PYTHONPATH而不直接入侵sys.path?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆