VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 152
声望: 4

想测试一下vnpy的ctp,
我运行vnpy\gateway\ctptest下面的ctptest_gateway文件,

却发生如下错误:

Traceback (most recent call last):
  File "ctptest_gateway.py", line 6, in <module>
    from .vnctpmd import MdApi
ModuleNotFoundError: No module named '__main__.vnctpmd'; '__main__' is not a pac
kage

请问要如何才能运行?
谢谢。

Administrator
avatar
加入于:
帖子: 4502
声望: 321

ctptest_gateway.py中,有这种相对引用的代码:

from .vnctpmd import MdApi

在Python 3中,任何有相对引用的py文件都无法直接运行,请另外写一个py文件,import这个test_gateway.py中的模块,再来运行

© 2015-2022 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】