我在 Raspberry Pi Revision B 上运行 Rapbian。
我按照此网页上的说明下载了模块 python-snap7:Snap7 Installation
我尝试了两次:一次使用 pip,另一次手动操作。但是,我通过setup.py build
然后 安装了它setup.py install
。
如果我尝试创建客户端,则会收到以下错误:
Python 2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import snap7
>>> c = snap7.client.Client()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/snap7/client.py", line 29, in __init__
self.library = load_library()
File "/usr/local/lib/python2.7/dist-packages/snap7/common.py", line 48, in load_library
return Snap7Library(lib_location).cdll
File "/usr/local/lib/python2.7/dist-packages/snap7/common.py", line 40, in __init__
raise Snap7Exception(msg)
snap7.exceptions.Snap7Exception: can't find snap7 library. If installed, try running ldconfig
收到此错误后,我执行了以下操作:
我在文件中添加了一些行,如下所示:
include /etc/ld.so.conf.d/*.conf
include /usr/local/lib/python2.7/dist-packages/snap7-full-1.2.1/
include /usr/local/lib/python2.7/dist-packages/snap7-full-1.2.1/release/Linux/ARMHF/Raspberry/
include /usr/local/lib/python2.7/dist-packages/snap7-full-1.2.1/src/lib/
include /usr/local/lib/python2.7/dist-packages/snap7-python/build/lib.linux-armv6l-2.7/snap7/
include /usr/local/lib/python2.7/dist-packages/snap7-python/
然后我发出了sudo ldconfig
更新缓存文件的命令/etc/ld.so.cache
,但错误仍然存在:(
include
在每一行的前面都有说明是否正确?- 是否有任何我没有看到的严重错误?
- 我需要包含哪个库?我只是想到了这里提供的:SourceForge Link。我选择了第一个 .tar.gz 包。
对不起我的英语,提前谢谢!