我正在尝试开发Python脚本,但似乎要在两个要包含的库之间发生冲突。
我具有的第一个依赖项是pymoos(https://github.com/msis/python-moos),它是连接到我的通信体系结构所必需的。我已经构建了代码,并在以下位置手动安装了生成的pymoos.so:
但是,只有python2.7允许我从解释器“导入pymoos”。尝试使用任一Python3版本都会产生以下结果:
Python 3.6.8 (default, Jun 11 2019, 15:15:01)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymoos
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define module export function (PyInit_pymoos)
第二个依赖关系是pydantic,我仅设法使用pip3进行安装,显然意味着它仅可从我已安装的任一Python3版本中使用。尝试从Python2导入将提供以下内容:
Python 2.7.5 (default, Jun 11 2019, 14:33:56)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pydantic
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pydantic
因为我知道pymoos.so库在哪里,所以我认为最简单的方法是将其放在正确的位置,以便它与python3一起使用,但我似乎找不到正确的位置!
根据我的评论:
它应该和一样简单pip install path/to/pymoos/code
,但是最好使用更广泛使用的数据库库(例如asyncpg或psycopg)。
关于必须使用sudo
,您可以考虑使用virtualenv
或类似方法为您的应用程序设置专用的python环境。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句