shiyuu
V2EX  ›  Jupyter

jupyter-notebook 内置环境变量问题

  •  
  •   shiyuu · Nov 21, 2022 · 1736 views
    This topic created in 1294 days ago, the information mentioned may be changed or developed.
    使用的模块比较特殊
    import pyfstat

    在运行的时候会因为变量问题无法 import


    按照官方的办法把当前的环境添加到变量才能正常 import
    现在有什么办法,不用每一个项目都要用这样的办法添加变量?
    linux 系统下的变量全都添加过了,但是在 jupyter-notebook 新建或者激活新项目都不会加载这个目录作为变量

    import os
    import sys
    env_bin = os.path.dirname(sys.executable)
    if not env_bin in os.environ["PATH"]:
    os.environ["PATH"] = f'{env_bin}:{os.environ["PATH"]}'

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   972 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 18:41 · PVG 02:41 · LAX 11:41 · JFK 14:41
    ♥ Do have faith in what you're doing.