[在Google colab中运行python脚本,nohup给出ImportError

问题描述 投票:1回答:1

我正在Google colab上运行它们。

在我的第一个单元中,我安装了必要的软件包

!pip install python_speech_features
!pip install soundfile

它提供以下日志,以确认它们已安装

Requirement already satisfied: python_speech_features in /usr/local/lib/python3.6/dist-packages (0.6)
Requirement already satisfied: soundfile in /usr/local/lib/python3.6/dist-packages (0.10.2)
Requirement already satisfied: cffi>=1.0 in /usr/local/lib/python3.6/dist-packages (from soundfile) (1.12.3)
Requirement already satisfied: pycparser in /usr/local/lib/python3.6/dist-packages (from cffi>=1.0->soundfile) (2.19)

Cell 4 and Cell 5

单元格4

显示我无问题地导入python_speech_features

单元格5

!nohup python run_1_Dataprep.py "conf/conf_dataprep.py" "conf/conf1_sr8k.py" |& tee run_1_Dataprep.log &

显示当我尝试使用]运行脚本时>

  • nohup :(这样就不会打h)和
  • |&tee
  • :它使我可以将所有输出记录到日志文件以及终端上
  • run_1_Dataprep.log
  • :我要存储所有终端输出的日志文件
  • :在后台运行。

    这些是错误消息,以防您无法查看图片

nohup: ignoring input
===========
python run_1_Dataprep.py conf/conf_dataprep.py conf/conf1_sr8k.py
2019-10-13 16:35:09.872582
===========
Traceback (most recent call last):
  File "run_1_Dataprep.py", line 9, in <module>
    from _helper_basics_ import *
  File "/content/gdrive/My Drive/Colab Notebooks/_helper_/_helper_basics_.py", line 27, in <module>
    import wave, python_speech_features#, pyaudio
ImportError: No module named python_speech_features

Cell 6 : showing that i can run the normal way

单元格6

当我刚跑步时,

!python run_1_Dataprep.py "conf/conf_dataprep.py" "conf/conf1_sr8k.py"

它运行成功。

虽然我可以在单元6中完美运行它,但我希望将日志写入日志文件,因此是单元5的目的。为什么它不能检测到我的预装软件包,并且有什么解决方法?

我正在Google colab上运行它们。我在第一个单元中pip安装了必要的软件包!pip install python_speech_features!pip install soundfile它给出以下日志,以声明...

python bash google-colaboratory nohup tee
1个回答
2
投票

我以为我会和你遇到同样的问题。当我在python virtualenv中运行“ nohup”和“&” set命令时,出现错误消息,例如:

© www.soinside.com 2019 - 2024. All rights reserved.