我想在我的项目中使用pyswip。我试图通过Pycharm安装pyswip。它可以成功安装。
问题是当我尝试运行快速运行测试时(以下示例代码来自Pyswip installation guide)
from pyswip import Prolog
prolog = Prolog()
prolog.assertz("father(michael,john)")
出现错误
ERROR: The system was unable to find the specified registry key or value.
Traceback (most recent call last):
File "C:/Users/Coregame/PycharmProjects/Project1/test.py", line 1, in <module>
from pyswip import Prolog
File "C:\Users\Coregame\PycharmProjects\Project1\venv\lib\site-packages\pyswip\__init__.py", line 29, in <module>
from pyswip.prolog import Prolog
File "C:\Users\Coregame\PycharmProjects\Project1\venv\lib\site-packages\pyswip\prolog.py", line 28, in <module>
from pyswip.core import *
File "C:\Users\Coregame\PycharmProjects\Project1\venv\lib\site-packages\pyswip\core.py", line 568, in <module>
(_path, SWI_HOME_DIR) = _findSwipl()
File "C:\Users\Coregame\PycharmProjects\Project1\venv\lib\site-packages\pyswip\core.py", line 411, in _findSwipl
(path, swiHome) = _findSwiplWin()
File "C:\Users\Coregame\PycharmProjects\Project1\venv\lib\site-packages\pyswip\core.py", line 208, in _findSwiplWin
match = pattern.match(ret[-1])
IndexError: list index out of range
我该怎么办?提前致谢!
您可能使用安装了32位SWI Prolog的64位pyswip。从here安装64位SWI Prolog,它应该可以解决问题,尽管你将无法使用SWI Prolog编辑器。