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

用神经网络做了一个策略模型,但是报错。
DNN_future是一个策略文件,在这个文件里定义了DNN_future_Strategy(CtaTemplate)类,在类里面调用了一个神经网络模型DNN_Futrue_model_V2用于预测市场,模型已经训练好了。但是在策略中调用这个模型的时候,出现了报错,报错如下,求指教是什么原因?
感觉是无法调用tensorflow,不知道原因是什么,求大神指教。

vnpy.app.cta_strategy.strategies.DNN_future加载失败,触发异常:
Traceback (most recent call last):
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_backtester\engine.py", line 110, in load_strategy_class_from_module
module = importlib.import_module(module_name)
File "c:\vnstudio\lib\importlib__init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\strategies\DNN_future.py", line 14, in <module>
import tensorflow as tf
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\
init.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\
init__.py", line 39, in <module>
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: 找不到指定的模块。

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

22:33:19 策略文件vnpy.app.cta_strategy.strategies.DNN_Futrue_Class加载失败,触发异常:
Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_backtester\engine.py", line 110, in load_strategy_class_from_module
module = importlib.import_module(module_name)
File "c:\vnstudio\lib\importlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'vnpy.app.cta_strategy.strategies.DNN_Futrue_Class'

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

22:33:19 策略文件strategies.DNN_Futrue_Class_V1加载失败,触发异常:
Traceback (most recent call last):
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_backtester\engine.py", line 110, in load_strategy_class_from_module
module = importlib.import_module(module_name)
File "c:\vnstudio\lib\importlib__init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\1\strategies\DNN_Futrue_Class_V1.py", line 2, in <module>
import tensorflow as tf
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\
init.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\
init__.py", line 39, in <module>
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: 找不到指定的模块。

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

22:33:19 策略文件strategies.DNN_Futrue_Class_V2加载失败,触发异常:
Traceback (most recent call last):
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_backtester\engine.py", line 110, in load_strategy_class_from_module
module = importlib.import_module(module_name)
File "c:\vnstudio\lib\importlib__init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\1\strategies\DNN_Futrue_Class_V2.py", line 12, in <module>
import tensorflow as tf
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\
init.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\
init__.py", line 39, in <module>
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\1\anaconda3\Lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: 找不到指定的模块。

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.

22:33:19 策略文件strategies.DNN_future加载失败,触发异常:
Traceback (most recent call last):
File "c:\vnstudio\lib\site-packages\vnpy\app\cta_backtester\engine.py", line 110, in load_strategy_class_from_module
module = importlib.import_module(module_name)
File "c:\vnstudio\lib\importlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\1\strategies\DNN_future.py", line 24, in <module>
from DNN_Futrue_Class_V2 import *
ModuleNotFoundError: No module named 'DNN_Futrue_Class_V2'

Member
avatar
加入于:
帖子: 127
声望: 13

略过了前面,从最后结果来看,
我推测:
你训练的环境是独立的装有tensorflow的python环境,
然后呢,python的版本x64/x86?

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

tensorflow 是安装在annaconda下的。我看了下,vnstudio是配置的python是在vnstudio文件夹下面的。
那请问如何解决这个问题呢?
(1)vnstudio的python修改至annaconda下的python解释器么?如果修改呢?
(2)如果要重新安装tensorflow到正确的位置,应该怎么安装呢?重新安装的话,怎样将tensorflow安装在C:\vnstudio\Lib\site-packages这个文件下呢?
我还是小白,多谢啦

kingmo888 wrote:

略过了前面,从最后结果来看,
我推测:
你训练的环境是独立的装有tensorflow的python环境,
然后呢,python的版本x64/x86?

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

沪公网安备 31011502017034号

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