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

今天尝试用python3.12环境安装vnpy_tap,一直报错ERROR: Could not build wheels for vnpy_tap, which is required to install pyproject.toml-based projects。想问一下是什么原因?

Member
avatar
加入于:
帖子: 1742
声望: 132

安装Visual Studio编译器

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

MTF wrote:

安装Visual Studio编译器
我有在用visual studio,3.10的python环境是没问题,但是3.12就不行

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

C:\Users\keith.yuan\PycharmProjects\VNPY-py12\vnpy_tap-main\vnpy_tap\api\include\pybind11\cast.h(441): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
C:\Users\keith.yuan\PycharmProjects\VNPY-py12\vnpy_tap-main\vnpy_tap\api\include\pybind11\cast.h(443): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
C:\Users\keith.yuan\PycharmProjects\VNPY-py12\vnpy_tap-main\vnpy_tap\api\include\pybind11\cast.h(444): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1890): error C2039: "frame": 不是 "_ts" 的成员
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\cpython/pystate.h(115): note: 参见“_ts”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1891): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1892): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1895): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1895): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1894): error C2660: “PyDict_GetItem”: 函数不接受 1 个参数
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\dictobject.h(22): note: 参见“PyDict_GetItem”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1894): note: 尝试匹配参数列表“()”时
vnpy_tap/api/vntap/vntaptd/vntaptd.cpp(5235): warning $996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\cl.exe' failed with exit code 2

这一部分的报错是因为写的h文件有问题吗?

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

C:\Users\keith.yuan\PycharmProjects\VNPY-py12\vnpy_tap-main\vnpy_tap\api\include\pybind11\cast.h(441): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
C:\Users\keith.yuan\PycharmProjects\VNPY-py12\vnpy_tap-main\vnpy_tap\api\include\pybind11\cast.h(443): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
C:\Users\keith.yuan\PycharmProjects\VNPY-py12\vnpy_tap-main\vnpy_tap\api\include\pybind11\cast.h(444): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1890): error C2039: "frame": 不是 "_ts" 的成员
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\cpython/pystate.h(115): note: 参见“_ts”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1891): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1892): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1895): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1895): error C2027: 使用了未定义类型“_frame”
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\pytypedefs.h(22): note: 参见“_frame”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1894): error C2660: “PyDict_GetItem”: 函数不接受 1 个参数
C:\Users\keith.yuan\AppData\Local\Programs\Python\Python312\include\dictobject.h(22): note: 参见“PyDict_GetItem”的声明
vnpy_tap/api/include\pybind11/pybind11.h(1894): note: 尝试匹配参数列表“()”时
vnpy_tap/api/vntap/vntaptd/vntaptd.cpp(5235): warning $996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\cl.exe' failed with exit code 2

这一部分的报错是因为写的h文件有问题吗?

Member
avatar
加入于:
帖子: 1742
声望: 132

错误是最后一条,这样试试:

  1. 下载Github仓库源码
  2. 修改setup.py,Windows系统下的extra_compile_flags为:

extra_compile_flags = ["-O2", "-MT", "_CRT_SECURE_NO_WARNINGS"]

如果还是不行就去Github开个issue吧

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

MTF wrote:

错误是最后一条,这样试试:

  1. 下载Github仓库源码
  2. 修改setup.py,Windows系统下的extra_compile_flags为:

extra_compile_flags = ["-O2", "-MT", "_CRT_SECURE_NO_WARNINGS"]

如果还是不行就去Github开个issue吧

像是3.12有些内置的头文件改动了,找不到里面的def function,不像是VS的问题呀

Member
avatar
加入于:
帖子: 5133
声望: 308

先在extra_compile_flags加"_CRT_SECURE_NO_WARNINGS"试试看吧

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

xiaohe wrote:

先在extra_compile_flags加"_CRT_SECURE_NO_WARNINGS"试试看吧

加过了 只是少了一些warning的报错,最后的报错还是一样的

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

沪公网安备 31011502017034号

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