【发布时间】:2020-03-21 11:37:09
【问题描述】:
我正在使用 GTDBtk 程序,这是一个使用其他程序的工具包。当我使用终端运行 GTDBtk 时,它给了我一个错误:
[2020-03-15 18:58:22] INFO: Using GTDB-Tk reference data version r89: /Users/Desktop/GTDB/gtdbtk/release89
hmmsearch is not on the system path.
我通过编写这段代码解决了这个问题
PATH="/Users/monkiky/Desktop/Data/hmmer-3.3/src/hmmsearch:$PATH"
现在,由于我需要多次运行这个程序,我正在用 Python 编写一个脚本。编写此代码我发现了同样的错误,我不知道如何解决它。
[2020-03-21 11:26:37] INFO: Using GTDB-Tk reference data version r89: /Users/monkiky/Desktop/GTDB/gtdbtk/release89
hmmsearch is not on the system path.
如何使用 python 定义路径?或者我做错了什么。
我试过这个,但运气不好:
os.system('PATH="/Users/monkiky/Desktop/Data/hmmer-3.3/src/hmmsearch:$PATH"')
这里是我完成的代码:
#Define directory
os.chdir('/Users/monkiky/Desktop/prueba/GTDBTk-1.0.1')
# We define the environment variable
os.environ['GTDBTK_DATA_PATH'] = "/Users/monkiky/Desktop/GTDB/gtdbtk/release89"
# Add the path of prodigal (here the problem bust be)
sys.path.append("/Users/monkiky/Desktop/GTDB/GTDBTk-1.0.1/hmmsearch")
#Run the program
os.system('gtdbtk identify --genome_dir /Users/monkiky/Desktop/GTDB/input --out_dir /Users/monkiky/Desktop/GTDB/prueba')
输出
2020-03-21 14:29:09] INFO: GTDB-Tk v1.0.2
[2020-03-21 14:29:09] INFO: gtdbtk identify --genome_dir /Users/monkiky/Desktop/GTDB/input --out_dir /Users/monkiky/Desktop/GTDB/prueba
[2020-03-21 14:29:09] INFO: Using GTDB-Tk reference data version r89: /Users/monkiky/Desktop/GTDB/gtdbtk/release89
hmmsearch is not on the system path.
[2020-03-21 14:29:09] ERROR: Controlled exit resulting from early termination.
<built-in function chdir>
【问题讨论】:
-
os.system启动一个新的 shell,在该 shell 中执行分配,然后该 shell 退出。 当前进程中的PATH没有改变。
标签: python path operating-system