我尝试使用它的 python-snap7 0.4 包装器安装 snap7(从 S7-1200 读取),但我总是使用以下简单代码进行回溯。
from time import sleep
import snap7
from snap7.util import *
import struct
plc = snap7.client.Client()
追溯:
>>>
Traceback (most recent call last):
File "Y:\Lonnox\Projekte\Bibliothek\Python und SPS\S7-1200 Test.py", line 6, in <module>
plc = snap7.client.Client()
File "C:\Python34\lib\site-packages\snap7\client.py", line 30, in __init__
self.library = load_library()
File "C:\Python34\lib\site-packages\snap7\common.py", line 54, in load_library
return Snap7Library(lib_location).cdll
File "C:\Python34\lib\site-packages\snap7\common.py", line 46, in __init__
raise Snap7Exception(msg)
snap7.snap7exceptions.Snap7Exception: can't find snap7 library. If installed, try running ldconfig
我安装 snap7 和 python 包装器的步骤是:
- 从 sourceforge 下载 snap7 并将 snap7.dll 和 snap7.lib 复制到 windows 8 的 system32 文件夹
- 使用 pip install python-snap7 安装包装器
如何在 Windows 上正确安装 snap7?
[pip 安装日志][1]