本文介绍了在OSX上安装pip cffi软件包失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在安装用于加密和Jasmin安装的cffi软件包.

I am installing cffi package for cryptography and Jasmin installation.

我在发布问题之前做了一些研究,所以我找到了以下选项,但似乎不起作用:

I did some research before posting question, so I found following option but which is seems not working:

python2.7

python2.7

错误

c/_cffi_backend.c:13:10: fatal error: 'ffi.h' file not found

#include <ffi.h>

         ^

1 warning and 1 error generated.

请在以下问题上指导我.

Please guide me on following issue.

谢谢

日志

bhushanvaiude$ env DYLD_LIBRARY_PATH=/usr/local/opt/openssl/lib/ ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" LDFLAGS="-L/usr/local/opt/openssl/lib" CFLAGS="-I/usr/local/opt/openssl/include" sudo -E pip install cffi
Password:
Downloading/unpacking cffi
  Downloading cffi-0.8.6.tar.gz (196kB): 196kB downloaded
  Running setup.py egg_info for package cffi
    warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
    1 warning generated.

Downloading/unpacking pycparser (from cffi)
  Downloading pycparser-2.10.tar.gz (206kB): 206kB downloaded
  Running setup.py egg_info for package pycparser

Installing collected packages: cffi, pycparser
  Running setup.py install for cffi
    warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
    1 warning generated.
    building '_cffi_backend' extension
    cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -I/usr/local/opt/openssl/include -Qunused-arguments -pipe -Wno-error=unused-command-line-argument-hard-error-in-future -DUSE__THREAD -I@@HOMEBREW_CELLAR@@/libffi/3.0.13/lib/libffi-3.0.13/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.9-intel-2.7/c/_cffi_backend.o
    warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]
    c/_cffi_backend.c:13:10: fatal error: 'ffi.h' file not found
    #include <ffi.h>
             ^
    1 warning and 1 error generated.
    error: command 'cc' failed with exit status 1
    Complete output from command /Users/****project path***/bin/python -c "import setuptools;__file__='/Users/****project path***/build/cffi/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/7w/8z_mn3g120n34bv0w780gnd00000gn/T/pip-e6d6Ay-record/install-record.txt --single-version-externally-managed --install-headers /Users/****project path***/include/site/python2.7:
    warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]

1 warning generated.

running install

running build

running build_py

creating build

creating build/lib.macosx-10.9-intel-2.7

creating build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/__init__.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/api.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/backend_ctypes.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/commontypes.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/cparser.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/ffiplatform.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/gc_weakref.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/lock.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/model.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/vengine_cpy.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/vengine_gen.py -> build/lib.macosx-10.9-intel-2.7/cffi

copying cffi/verifier.py -> build/lib.macosx-10.9-intel-2.7/cffi

running build_ext

building '_cffi_backend' extension

creating build/temp.macosx-10.9-intel-2.7

creating build/temp.macosx-10.9-intel-2.7/c

cc -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -I/usr/local/opt/openssl/include -Qunused-arguments -pipe -Wno-error=unused-command-line-argument-hard-error-in-future -DUSE__THREAD -I@@HOMEBREW_CELLAR@@/libffi/3.0.13/lib/libffi-3.0.13/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c c/_cffi_backend.c -o build/temp.macosx-10.9-intel-2.7/c/_cffi_backend.o

warning: unknown warning option '-Werror=unused-command-line-argument-hard-error-in-future'; did you mean '-Werror=unused-command-line-argument'? [-Wunknown-warning-option]

c/_cffi_backend.c:13:10: fatal error: 'ffi.h' file not found

#include <ffi.h>

         ^

1 warning and 1 error generated.

error: command 'cc' failed with exit status 1

----------------------------------------
Cleaning up...

推荐答案

在您的终端中尝试运行:

In your terminal try and run:

xcode-select --install

之后,请尝试再次安装该软件包.

After that try installing the package again.

默认情况下,XCode会自己安装为IDE,并且不会设置供命令行工具使用的环境.例如,/usr/include文件夹将丢失.

By default, XCode installs itself as the IDE and does not set up the environment for the use by command line tools; for example, the /usr/include folder will be missing.

运行以上命令将安装从命令行运行编译并创建所需的符号链接所必需的工具.由于Python软件包使用XCode的命令行界面来编译本地代码部分,因此需要执行此步骤来安装包含本地组件的Python软件包.

Running the above command will install the tools necessary to run compilation from the command line and create the required symbolic links. Since Python packages compile native code parts using the command-line interface of XCode, this step is required to install Python packages that include native components.

您每次XCode安装/升级只需要执行一次,或者看到类似的错误.

You only need to do this once per XCode install/upgrade, or if you see a similar error.

这篇关于在OSX上安装pip cffi软件包失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:17