【发布时间】:2020-07-23 19:15:27
【问题描述】:
假设我有
project
|__ utilities
| |__ foo.py
|
|__ boost_extensions
| |__ myclass.cpp
| |__ myclass.so
|
|__ someotherstuff
| |__ bar.py
|
|__ mylib.py
|
|__ __main__.py
是否可以在 main.py
中做这样的事情import .utilities.foo as Foo
# this function will pass Foo to C++ and initialize it to a global variable
initCppFunction(Foo)
我已经尝试过了,但它给了我一个无效的语法错误(由于从 boost/python 导入 python 模块的一些问题,我正在尝试这样做)。有没有办法做到这一点?
谢谢
【问题讨论】:
标签: python python-3.x import python-import boost-python