Operating environment
Operating system: win7 64-bit
python version: 2.7.9
1. Install OpenOPC
1.1 Download OpenOPC-1.3.1.win32-py2.7.exe and install
1.2 pip installation dependency packages Pywin32 and Pyro
1.3 Copy OpenOPC.py under the src folder under the OpenOPC installation directory to Lib\site- under the python installation directory
1.4 Modify the environment variable
OPC_MODE = open in the packages directory
2. Connect to the opc server
# 导入包
import OpenOPC
# 生成OpenOPC实例(Open mode)
opc = OpenOPC.open_client('localhost') # Gateway Service,默认的PORT为7766
# 显示可连接的opc服务器
print opc.