gpt4 book ai didi

python:导入 libpci 引发 SyntaxError

转载 作者:行者123 更新时间:2023-11-30 22:48:40 25 4
gpt4 key购买 nike

我刚刚在我的机器上安装了 libpci:

$ pip2.7 install libpci

并尝试运行这个:

#!/usr/local/bin/python2.7
import libpci

print('hello libpci')

但这会引发以下语法错误:

Traceback (most recent call last):
File "./test.py", line 2, in <module>
import libpci
File "/usr/local/lib/python2.7/site-packages/libpci/__init__.py", line 26, in <module>
from libpci.wrapper import LibPCI
File "/usr/local/lib/python2.7/site-packages/libpci/wrapper.py", line 26, in <module>
from libpci._functions import pci_alloc
File "/usr/local/lib/python2.7/site-packages/libpci/_functions.py", line 39
def pci_alloc() -> ctypes.POINTER(pci_access):
^
SyntaxError: invalid syntax

libpci 中怎么可能引发 SyntaxError?
是因为我缺少一些依赖项吗?

最佳答案

libpci project需要 Python 3.4 或更高版本。来自项目标签:

Categories
[...]
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4

抛出语法错误,因为项目使用 annotations ,Python 3 功能,要配置 ctypes 层,请参阅 _ctypes_metadata() function .

关于python:导入 libpci 引发 SyntaxError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40084353/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com