[英]Can not read file from libpgm package
I installed libpgm for my jupyter notebook by我为我的 jupyter notebook 安装了 libpgm
pip install libpgm pip 安装 libpgm
and then ran several imports as follow然后运行几个导入如下
import sys
import json
import libpgm
from libpgm.nodedata import NodeData
from libpgm.graphskeleton import GraphSkeleton
from libpgm.hybayesiannetwork import HyBayesianNetwork
I got an error我有一个错误
Traceback (most recent call last):
File "C:\Users\19413\conda\lib\site-packages\IPython\core\interactiveshell.py", line 3343, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-7-80536a116c64>", line 4, in <module>
from libpgm.nodedata import NodeData
File "C:\Users\19413\conda\lib\site-packages\libpgm\nodedata.py", line 91
print "Error: NodeData did not recognize input file format."
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Error: NodeData did not recognize input file format.")?
Does anyone know what caused the error?有谁知道是什么导致了错误?
Thanks very much for your help非常感谢您的帮助
Well, the last line of your error report says exactly what caused the error:好吧,错误报告的最后一行准确地说明了导致错误的原因:
Missing parentheses in call to 'print'. Did you mean print("Error: NodeData did not recognize input file format.")?
Unlike Python 2, Python 3 requires all print statements to be enclosed in parentheses.与 Python 2 不同,Python 3 要求将所有打印语句括在括号中。 I'm not familiar with the
libpgm
library but it seems to me that this has been fixed five years ago .我不熟悉
libpgm
库,但在我看来,这已在五年前修复。 Make sure that you use the newest version of this library or run your code with Python 2 instead.确保您使用此库的最新版本或使用 Python 2 运行您的代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.