dictionary - 在 nogil 中使用 dict
问题描述
我想在 nogil 中使用字典。我已经阅读了这个问题和@DavidW 的评论:
所以我尝试在 file.pyx 中这样做:
# cython: language_level=3
cimport cpython.dict
cdef cpython.dict some_cdict
我的 setup.py 文件如下所示:
from setuptools import setup
from Cython.Build import cythonize
import numpy as np
setup(
ext_modules=cythonize('file.pyx', annotate=True),
include_dirs=[np.get_include()]
)
这是我编译它的调用:
python setup.py build_ext --inplace
但我得到这个错误:
file.pyx:3:5: 'dict' is not a type identifier
我究竟做错了什么?
我也看到了这个解决方案,但我更愿意使用 CPython 中的对象而不是 libcpp:
解决方案
推荐阅读
- ruby - 如何从 Ruby 查询 Active Directory OU 中的对象列表
- amazon-web-services - 每月第一天的异常 AWS 账单费用
- javascript - 使用多个“where”值查询 Firestore 字段/值?
- python - 如何拆分数据集并输入 input_fn
- python - 如何将 yticks 或 xticks 格式化为 seaborn 热图百分比
- postgresql - 为什么 PostgreSQL 不为此连接查询使用索引
- python - 对象跟踪程序在输出图像中不显示跟踪点
- ios - react-native run-ios 仅在安装 pod 后第一次工作
- lisp - 显示整个列表的弹出功能
- azure-devops - 未通过 Azure DevOps API 获取完整的管道运行信息