获取 pyswip 包的版本号
Get version number for pyswip package
我已经在我的系统中安装了 pyswip 包。当我使用 import pyswip
导入 pyswip
包时,没有错误,但看不到它的版本详细信息。
swipl -dump-runtime-variables
给出:
CC="gcc";
PLBASE="/usr/lib/swipl-6.6.6";
PLARCH="i686-linux";
PLLIBS="";
PLLIB="-lswipl";
PLCFLAGS="-fno-strict-aliasing -pthread -fPIC ";
PLLDFLAGS="-rdynamic -O2 -pthread -Wl,-rpath=/usr/lib/swipl-6.6.6/lib/i686-linux ";
PLSOEXT="so";
PLSOPATH="LD_LIBRARY_PATH";
PLVERSION="60606";
PLSHARED="yes";
PLTHREADS="yes";
pyswip -V 给出:
pyswip: command not found
是否有任何方法可以获取此软件包的版本或安装详细信息?
你是如何安装这个包的?如果你使用的是pip,你可以这样查看版本:
pip freeze | grep pyswip
或在运行时:
import pkg_resources
pkg_resources.get_distribution("pyswip").version
我认为没有 pyswip
命令行实用程序;毕竟,这是一个图书馆。
然而,pyswip
的 __init__.py
包含一个 __VERSION__
字符串,因此
import pyswip
print pyswip.___VERSION___
应该可以。
编辑:添加__init__.py
(省略几行评论);如果安装在您系统上的 pyswip/__init__.py
不包含 __VERSION__
字符串,则它太旧了。
# -*- coding: utf-8 -*-
# pyswip -- Python SWI-Prolog bridge
# Copyright (c) 2007-2012 Yüce Tekol
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# .... MIT license ....
# PySWIP version
__VERSION__ = "0.2.3"
from pyswip.prolog import Prolog
from pyswip.easy import *
我已经在我的系统中安装了 pyswip 包。当我使用 import pyswip
导入 pyswip
包时,没有错误,但看不到它的版本详细信息。
swipl -dump-runtime-variables
给出:
CC="gcc";
PLBASE="/usr/lib/swipl-6.6.6";
PLARCH="i686-linux";
PLLIBS="";
PLLIB="-lswipl";
PLCFLAGS="-fno-strict-aliasing -pthread -fPIC ";
PLLDFLAGS="-rdynamic -O2 -pthread -Wl,-rpath=/usr/lib/swipl-6.6.6/lib/i686-linux ";
PLSOEXT="so";
PLSOPATH="LD_LIBRARY_PATH";
PLVERSION="60606";
PLSHARED="yes";
PLTHREADS="yes";
pyswip -V 给出:
pyswip: command not found
是否有任何方法可以获取此软件包的版本或安装详细信息?
你是如何安装这个包的?如果你使用的是pip,你可以这样查看版本:
pip freeze | grep pyswip
或在运行时:
import pkg_resources
pkg_resources.get_distribution("pyswip").version
我认为没有 pyswip
命令行实用程序;毕竟,这是一个图书馆。
然而,pyswip
的 __init__.py
包含一个 __VERSION__
字符串,因此
import pyswip
print pyswip.___VERSION___
应该可以。
编辑:添加__init__.py
(省略几行评论);如果安装在您系统上的 pyswip/__init__.py
不包含 __VERSION__
字符串,则它太旧了。
# -*- coding: utf-8 -*-
# pyswip -- Python SWI-Prolog bridge
# Copyright (c) 2007-2012 Yüce Tekol
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# .... MIT license ....
# PySWIP version
__VERSION__ = "0.2.3"
from pyswip.prolog import Prolog
from pyswip.easy import *