vn.py量化社区
By Traders, For Traders.
Member
avatar
加入于:
帖子: 6
声望: 0

自己示例程序写了如下run.py,执行后出错。
from vnpy.event import EventEngine
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import MainWindow, create_qapp
from vnpy.gateway.ctp import CtpGateway
from vnpy.app.cta_strategy import CtaStrategyApp

def main():
"""Start VN Trader"""
qapp = create_qapp()

event_engine = EventEngine()
main_engine = MainEngine(event_engine)

main_engine.add_gateway(CtpGateway)
main_engine.add_app(CtaStrategyApp)

main_window = MainWindow(main_engine, event_engine)
main_window.showMaximized()

qapp.exec()


if name == "main":
main()

出现如下错误=======================>

Traceback (most recent call last):
File "C:\ProgramData\VNConda\lib\site-packages\numpy\core__init__.py", line 16, in <module>
from . import multiarray
ImportError: DLL load failed: %1 不是有效的 Win32 应用程序。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/vnpy-2.0.2/qic/run.py", line 2, in <module>
from vnpy.trader.engine import MainEngine
File "C:\vnpy-2.0.2\vnpy\trader\engine.py", line 26, in <module>
from .setting import SETTINGS
File "C:\vnpy-2.0.2\vnpy\trader\setting.py", line 7, in <module>
from .utility import load_json
File "C:\vnpy-2.0.2\vnpy\trader\utility.py", line 9, in <module>
import numpy as np
File "C:\ProgramData\VNConda\lib\site-packages\numpy__init.py", line 142, in <module>
from . import add_newdocs
File "C:\ProgramData\VNConda\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\ProgramData\VNConda\lib\site-packages\numpy\lib\
init.py", line 8, in <module>
from .type_check import *
File "C:\ProgramData\VNConda\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\ProgramData\VNConda\lib\site-packages\numpy\core\
init__.py", line 26, in <module>
raise ImportError(msg)
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try git clean -xdf (removes all
files not under version control). Otherwise reinstall numpy.

Original error was: DLL load failed: %1 不是有效的 Win32 应用程序。

Process finished with exit code 1

Administrator
avatar
加入于:
帖子: 1441
声望: 63

这个是numpy的DLL加载错误导致的,可能环境被破坏了吧:
pip uninstall numpy
pip install numpy

应该就能解决了

Member
avatar
加入于:
帖子: 6
声望: 0

重新安装 numpy 1.16.3 后, 运行 python run.py, python 程序报错。 错误信息如下:

问题签名:
问题事件名称: APPCRASH
应用程序名: python.exe
应用程序版本: 3.7.150.1013
应用程序时间戳: 5b34dd6a
故障模块名称: libopenblas.IPBC74C7KURV7CB2PKT5Z5FNR3SIBV4J.gfortran-win_amd64.
故障模块版本: 0.0.0.0
故障模块时间戳: 5cbcde25
异常代码: c000001d
异常偏移: 00000000010fecc1
OS 版本: 6.1.7601.2.1.0.274.10
区域设置 ID: 2052
其他信息 1: 753d
其他信息 2: 753dccad1d6d05691900c4bfecccafaa
其他信息 3: 5ec1
其他信息 4: 5ec122d7c777f1340a189b487718a9dc

联机阅读隐私声明:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0804

如果无法获取联机隐私声明,请脱机阅读我们的隐私声明:
C:\Windows\system32\zh-CN\erofflps.txt

Administrator
avatar
加入于:
帖子: 1441
声望: 63

pip uninstall numpy
conda install numpy

这个报错是pip上的numpy依赖库openblas问题了

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