Home  >  Q&A  >  body text

linux - 直接python程序运行没有问题,nohup运行就出错了,该怎么解决啊?

伊谢尔伦伊谢尔伦2742 days ago953

reply all(5)I'll reply

  • 迷茫

    迷茫2017-04-18 09:26:27

    virtualenvHave you sourced it? before nohup

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-18 09:26:27

    I have never encountered your problem before.
    But you can turn the program into a service, so it will not be killed when the shell exits. The simplest way to create a service is to use supervisor, which is also implemented in python under Linux.

    =====
    To add, there is a relatively simple way to use the screen command. For example:

    screen -S xyz (Choose a memorable name)
    python xxx.py (start your program)
    ctrl+a+d
    Then just exit.
    After logging in next time, execute:

    screen -r xyz
    You can return to the interface you last exited

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 09:26:27

    Looks like an environment variable issue

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 09:26:27

    This looks like an environment variable problem.
    It’s really impossible to write a fork function and turn it into a daemon process.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 09:26:27

    I have encountered the same situation. If the test can run, it means that the code is correct.
    According to the error message: The specified module cannot be found in the currently running python version. The most likely cause is a version conflict.
    In order to ensure that the correct python version is running, it is best to It’s as simple as running the absolute path
    The classmate who asked for advice also asked me to compile alias npy3=nohup python-absolute-path

    reply
    0
  • Cancelreply