python - 在 Windows 上安装 python 库 cffi

标签 python python-cffi

如果我pip install cffi,我得到这个:

building '_cffi_backend' extension
c:\mingw\bin\gcc.exe -mdll -O -Wall -Ic/libffi_msvc -IC:\python27\include -IC:\python27\PC -c c/_cffi_backend.c -o build\temp.win32-2.7\Release\c\_cffi_backend.o
...
(lots of warnings)
...
c/libffi_msvc\win32.c: In function 'ffi_call_x86':
c/libffi_msvc\win32.c:48:2: error: '_asm' undeclared (first use in this function)
c/libffi_msvc\win32.c:48:2: note: each undeclared identifier is reported only once for each function it appears in
c/libffi_msvc\win32.c:48:7: error: expected ';' before '{' token
c/libffi_msvc\win32.c:162:1: warning: control reaches end of non-void function [-Wreturn-type]
error: command 'gcc' failed with exit status 1

这显然是在使用 MinGW。

我还尝试从 wheel 安装 here :

pip install https://pypi.python.org/packages/cp27/c/cffi/cffi-0.8.6-cp27-none-win32.whl#md5=aedc78351af65c4f514df0f2812473eb

我收到以下奇怪的错误:

Downloading/unpacking https://pypi.python.org/packages/cp27/c/cffi/cffi-0.8.6-cp27-none-win32.whl
  Downloading cffi-0.8.6-cp27-none-win32.whl (77kB): 77kB downloaded
  Running setup.py egg_info for package from https://pypi.python.org/packages/cp27/c/cffi/cffi-0.8.6-cp27-none-win32.whl
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
    IOError: [Errno 2] No such file or directory: 'c:\\users\\me\\appdata\\local\\temp\\pip-nkx4aq-build\\setup.py'

事实上,当我查看那个(临时)pip-nkx4aq-build 目录时,我发现那里没有 setup.py。

所以,我的问题只是,为什么会失败,我需要做什么才能在 Windows 上安装 cffi?

最佳答案

关于python - 在 Windows 上安装 python 库 cffi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28261202/

相关文章:

python - 安装 Anaconda3 时的问题

python - BeautifulSoup:从 findAll ResultSet 中剥离 HTML 标签

python - 生成的 Windows exe (pyinstaller) 无法加载 _cffi_backend

python - 有没有办法使用 PyQt 实现循环等待指示器?

带有 xml.etree.ElementTree : multiple conditions 的 Python xpath

python - 获取字典中特定键的值

android - Python 和 Dalvik 或 AAF 之间的本地桥梁

Python-C 集成 : Ctypes, CFFI 或创建二进制模块

python - 如何使用指针在 Numba 中包装 CFFI 函数

python - 如何将指向 Python cffi 结构的指针转换为 System.IntPtr (.NET)?