IoT Azure Edge 上下文版本冲突:pyOpenSSL

IoT Azure Edge ContextualVersionConflict: pyOpenSSL

我正在关注 Azure IoT Edge 快速入门 教程和 Configure the IoT Edge runtime 部分。

当我使用 IoT Edge 设备连接字符串配置运行时时

iotedgectl setup --connection-string "{device connection string}" --nopass

(我更改了连接字符串)我得到以下结果

Traceback (most recent call last):
  File "/usr/local/bin/iotedgectl", line 11, in <module>
    sys.exit(coremain())
  File "/Library/Python/2.7/site-packages/edgectl/__init__.py", line 23, in coremain
    version = pkg_resources.require(PACKAGE_NAME)[0].version
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 959, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 851, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pyOpenSSL 0.13.1 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python), Requirement.parse('pyOpenSSL>=0.14'), set(['docker']))

这不允许我继续执行命令

iotedgectl start

我查看了文件init.py从第857-859行有:

        # Register the new requirements needed by req
        for new_requirement in new_requirements:
            required_by[new_requirement].add(req.project_name)

第 848 - 851 行

 if dist not in req:
                # Oops, the "best" so far conflicts with a dependency
                dependent_req = required_by[req]
                raise VersionConflict(dist, req).with_context(dependent_req)

第 959 行

needed = self.resolve(parse_requirements(requirements))

我需要在那里更改什么?或者需要配置什么?

从消息来看,pyOpenSSL太旧,需要0.14或更高版本。

Traceback (most recent call last):
  File "/usr/local/bin/iotedgectl", line 11, in <module>
    sys.exit(coremain())
  File "/Library/Python/2.7/site-packages/edgectl/__init__.py", line 23, in coremain
    version = pkg_resources.require(PACKAGE_NAME)[0].version
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py",
 line 959, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py",
 line 851, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (pyOpenSSL 0.13.1 (/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python),
 Requirement.parse('pyOpenSSL>=0.14'), set(['docker']))

您可以使用以下命令升级pyOpenSSL:

pip install --upgrade pyOpenSSL

如果问题无法解决,请随时告诉我。

在安装 iotedgectl 之前,您已经安装了较低版本的 pyOpenSSL,它不符合 iotedgectl 的版本要求,但先于与 iotedgectl 一起安装的较高版本的 pyOpenSSL。

您可以查看 this answer 以了解如何使 Python 首先引用更高版本的 pyOpenSSL。

另外,您似乎在 macOS 上工作。如果有,请参考Quickstart: Deploy your first IoT Edge module to a Linux or Mac device - preview, instead of Quickstart: Deploy your first IoT Edge module from the Azure portal to a Windows device - preview.