shepherdpp / qteasy

a python-based fast quantitative investment module
BSD 3-Clause "New" or "Revised" License
73 stars 28 forks source link

新手实在运行不起来,请教牛人 #92

Closed ziarcher closed 8 months ago

ziarcher commented 9 months ago

Python 3.11.7 (tags/v3.11.7:fa7a6f2, Dec 4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)] on win32

import qteasy as qt Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2023.3.1\plugins\python\helpers\pydev\pydevconsole.py", line 364, in runcode coro = func() ^^^^^^ File "", line 1, in File "C:\Program Files\JetBrains\PyCharm 2023.3.1\plugins\python\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\yuewe\Documents\GitHub\qteasy-master.venv\Lib\site-packages\qteasy__init__.py", line 22, in from .core import run, set_config, get_configurations, get_config File "C:\Program Files\JetBrains\PyCharm 2023.3.1\plugins\python\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\yuewe\Documents\GitHub\qteasy-master.venv\Lib\site-packages\qteasy\core.py", line 23, in from .history import get_history_panel, HistoryPanel, stack_dataframes File "C:\Program Files\JetBrains\PyCharm 2023.3.1\plugins\python\helpers\pydev_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\yuewe\Documents\GitHub\qteasy-master.venv\Lib\site-packages\qteasy\history.py", line 20, in class HistoryPanel(): File "C:\Users\yuewe\Documents\GitHub\qteasy-master.venv\Lib\site-packages\qteasy\history.py", line 636, in HistoryPanel def fillna(self, with_val: [int, float, int, np.float]): ^^^^^^^^ File "C:\Users\yuewe\Documents\GitHub\qteasy-master.venv\Lib\site-packages\numpy__init.py", line 338, in getattr raise AttributeError(former_attrs__[attr]) AttributeError: module 'numpy' has no attribute 'float'. np.float was a deprecated alias for the builtin float. To avoid this error in existing code, use float by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.float64 here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'cfloat'?

shepherdpp commented 9 months ago

谢谢您报告此问题,这是个numpy的版本兼容性问题。请检查您使用的numpy的版本:

>>> import numpy as np
>>> np.__version__

最新的numpy版本已经去掉了一些数据类型的支持,我会在下个发行版本中修复此问题。 现在您要继续使用qteasy,可以强制安装1.21.5版本的numpy

$ pip install --force-reinstall numpy==1.21.5

安装好之后仍然会有DeprecationWarning,但是运行不会有问题

ziarcher commented 9 months ago

大佬居然回复了, 太感谢了!(^▽^)

shepherdpp commented 8 months ago

您客气了! 这几天正在着手检查版本兼容性的问题,建议在一个独立的环境中安装qteasy。另外,修正问题的同时,我也会更新使用教程,力图更加清晰易懂