如何修复 pysb Exception: The program BioNetGen was not found in the default search path(s) for your operating system
问题
运行 PySB 模型时,你看到如下错误消息
error-output.txt
Exception: The program BioNetGen was not found in the default search path(s) for your operating system:
/usr/local/share/BioNetGen
/usr/bin
/home/user/.local/bin
/home/user/.pyenv/shims
/home/user/.pyenv/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/sbin
/bin
/usr/games
/usr/local/games
/snap/bin
Either install it to one of those paths, or set a custom path using the environment variable BNGPATH or by calling the function pysb.pathfinder.set_path()
Conda users can install BioNetGen using the following command:
conda install -c alubbock bionetgen解决方案
首先,从官方仓库克隆 BioNetGen 到你选择的文件夹。在此示例中,我们将使用 ~/bionetgen:
clone-bionetgen.sh
git clone --depth 1 -b BioNetGen-2.9.2 https://github.com/RuleWorld/bionetgen.git然后,在运行任何 pysb 代码之前,通过插入以下 Python 代码将 BNGPATH 环境变量设置为你克隆 BioNetGen 的路径:
set-bngpath.py
import os
import os.path
os.environ['BNGPATH'] = os.path.expanduser('~/bionetgen/bng2')注意,BNGPATH 必须设置为克隆的 BioNetGen 仓库的 bng2 子文件夹!
重新运行整个程序 - 现在,错误应该消失了。
Check out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow