我是使用python的newbe。
我通过Modbus模拟服务器和客户端之间的连接。我用pymodbus库做到了。
我的服务器是异步服务器,我知道必须在覆盆子上安装加密才能使其正常工作。
我发现了这些说明并且我遵循了:
-sudo apt-get install build-essential libssl-dev libffi-dev python-dev;
-sudo pip install cryptography;
之后,我有一个错误:
Traceback (most recent call last):
File "modbus_server.py", line 4, in <module>
from pymodbus.server.async import StartTcpServer
File "/usr/local/lib/python2.7/dist-packages/pymodbus/server/async.py", line 18, in <module>
from pymodbus.internal.ptwisted import InstallManagementConsole
File "/usr/local/lib/python2.7/dist-packages/pymodbus/internal/ptwisted.py", line 5, in <module>
from twisted.conch import manhole, manhole_ssh
File "/usr/local/lib/python2.7/dist-packages/twisted/conch/manhole_ssh.py", line 14, in <module>
from twisted.conch.ssh import factory, session
File "/usr/local/lib/python2.7/dist-packages/twisted/conch/ssh/factory.py", line 17, in <module>
from twisted.conch.ssh import (_kex, transport, userauth, connection)
File "/usr/local/lib/python2.7/dist-packages/twisted/conch/ssh/transport.py", line 23, in <module>
from cryptography.hazmat.backends import default_backend
File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
import pkg_resources
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 70, in <module>
import packaging.version
ImportError: No module named packaging.version
我在Windows机器上尝试了相同的代码python进入Eclipse,它可以工作。
我该如何解决这个问题?
答案 0 :(得分:1)
缺少依赖
运行pip install packaging