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

各位大佬好,今天安装vnpy,每次import cta_strategy都会出现如下问题

#

C:\vnstudio\lib\site-packages\vnpy\app\cta_strategy__init__.py in <module>
8 from .base import APP_NAME, StopOrder
9 from .engine import CtaEngine
---> 10 from .backtesting import BacktestingEngine, OptimizationSetting
11 from .template import CtaTemplate, CtaSignal, TargetPosTemplate
12

C:\vnstudio\lib\site-packages\vnpy\app\cta_strategy\backtesting.py in <module>
11 import numpy as np
12 import matplotlib.pyplot as plt
---> 13 import seaborn as sns
14 from pandas import DataFrame
15 from deap import creator, base, tools, algorithms

~\AppData\Roaming\Python\Python37\site-packages\seaborn__init__.py in <module>
1 # Import seaborn objects
----> 2 from .rcmod import # noqa: F401,F403
3 from .utils import
# noqa: F401,F403
4 from .palettes import # noqa: F401,F403
5 from .relational import
# noqa: F401,F403

~\AppData\Roaming\Python\Python37\site-packages\seaborn\rcmod.py in <module>
5 import matplotlib as mpl
6 from cycler import cycler
----> 7 from . import palettes
8
9

~\AppData\Roaming\Python\Python37\site-packages\seaborn\palettes.py in <module>
7 from .external import husl
8
----> 9 from .utils import desaturate, get_color_cycle
10 from .colors import xkcd_rgb, crayons
11

~\AppData\Roaming\Python\Python37\site-packages\seaborn\utils.py in <module>
8
9 import numpy as np
---> 10 from scipy import stats
11 import pandas as pd
12 import matplotlib as mpl

C:\vnstudio\lib\site-packages\scipy\stats__init.py in <module>
382 from
future__ import division, print_function, absolute_import
383
--> 384 from .stats import
385 from .distributions import

386 from .morestats import *

C:\vnstudio\lib\site-packages\scipy\stats\stats.py in <module>
177
178 from scipy._lib.six import callable, string_types
--> 179 from scipy.spatial.distance import cdist
180 from scipy.ndimage import measurements
181 from scipy._lib._version import NumpyVersion

C:\vnstudio\lib\site-packages\scipy\spatial__init__.py in <module>
97 from .kdtree import
98 from .ckdtree import

---> 99 from .qhull import
100 from ._spherical_voronoi import SphericalVoronoi
101 from ._plotutils import

ImportError: DLL load failed: 系统无法访问此文件。

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

核心问题是这个
from scipy.spatial.distance import cdist
其实 from scipy import spatial 就会出错,网上找了很久没找到解决办法

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

可以检查一下是否环境变量配置正确,也有可能是scipy缺少了什么组件,可以卸载重装一下这个包

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

沪公网安备 31011502017034号