- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
如何通过 pip
安装 cairocffi
?
cairocffi
是一个基于 CFFI 的替代 Pycairo
https://github.com/SimonSapin/cairocffi .
我正在尝试在 Ubuntu 14.04 上安装它:
alvas@ubi:~$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS"
NAME="Ubuntu"
VERSION="14.04.2 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.2 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
我已经尝试使用标准 pip 命令进行安装,但我得到了这个:
$ sudo pip install cairocffi
The directory '/home/alvas/.cache/pip/log' or its parent directory is not owned by the current user and the debug log has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/alvas/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/alvas/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting cairocffi
Downloading cairocffi-0.6.tar.gz (75kB)
100% |████████████████████████████████| 77kB 34kB/s
Collecting cffi>=0.6 (from cairocffi)
Downloading cffi-0.9.2.tar.gz (209kB)
100% |████████████████████████████████| 212kB 97kB/s
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python3.4/dist-packages (from cffi>=0.6->cairocffi)
Installing collected packages: cffi, cairocffi
Running setup.py install for cffi
Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-d3kjzf__/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ll323a3c-record/install-record.txt --single-version-externally-managed --compile:
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/gc_weakref.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.4/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/c
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.4/c/_cffi_backend.o
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-d3kjzf__/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ll323a3c-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-d3kjzf__/cffi
我手动检查了权限,发现没有写访问权限。 为什么会这样?为什么 sudo 不能覆盖权限?
$ ls -la .cache/pip/log/
total 60
drwxrwxr-x 2 alvas alvas 4096 Feb 3 10:51 .
drwx------ 4 alvas alvas 4096 Apr 12 23:16 ..
-rw-rw-r-- 1 alvas alvas 49961 Apr 12 23:18 debug.log
当我尝试 sudo -H pip install cairoffi
时,我得到:
sudo -H pip install cairocffi
Collecting cairocffi
Using cached cairocffi-0.6.tar.gz
Collecting cffi>=0.6 (from cairocffi)
Downloading cffi-0.9.2.tar.gz (209kB)
100% |████████████████████████████████| 212kB 29kB/s
Requirement already satisfied (use --upgrade to upgrade): pycparser in /usr/local/lib/python3.4/dist-packages (from cffi>=0.6->cairocffi)
Installing collected packages: cffi, cairocffi
Running setup.py install for cffi
Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-2sv6pbsp/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xk4kkjrj-record/install-record.txt --single-version-externally-managed --compile:
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
Package libffi was not found in the pkg-config search path.
Perhaps you should add the directory containing `libffi.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libffi' found
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/cffi
copying cffi/commontypes.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/lock.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/api.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/verifier.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/__init__.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/cparser.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/vengine_gen.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/gc_weakref.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/ffiplatform.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/model.py -> build/lib.linux-x86_64-3.4/cffi
copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-3.4/cffi
running build_ext
building '_cffi_backend' extension
creating build/temp.linux-x86_64-3.4
creating build/temp.linux-x86_64-3.4/c
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.4/c/_cffi_backend.o
c/_cffi_backend.c:13:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-2sv6pbsp/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-xk4kkjrj-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-2sv6pbsp/cffi
正如@MattDMo 所建议的,我已经尝试了 apt-get install libffi
但它仍然没有成功:
alvas@ubi:~$ sudo apt-get install libffi libffi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libffi
但是包管理器上没有任何libffi
,所以我尝试了libffi-dev
:
alvas@ubi:~$ sudo apt-get install libffi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libffi-dev
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 99.8 kB of archives.
After this operation, 323 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu/ trusty/main libffi-dev amd64 3.1~rc1+r3.0.13-12 [99.8 kB]
Fetched 99.8 kB in 1s (76.3 kB/s)
Selecting previously unselected package libffi-dev:amd64.
(Reading database ... 492855 files and directories currently installed.)
Preparing to unpack .../libffi-dev_3.1~rc1+r3.0.13-12_amd64.deb ...
Unpacking libffi-dev:amd64 (3.1~rc1+r3.0.13-12) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for doc-base (0.10.5) ...
Processing 1 added doc-base file...
Processing triggers for install-info (5.2.0.dfsg.1-2) ...
Setting up libffi-dev:amd64 (3.1~rc1+r3.0.13-12) ...
它成功安装了 libffi-dev
但 cairoffi
仍然没有安装:
alvas@ubi:~$ sudo -H pip install cairoffi
Collecting cairoffi
Could not find a version that satisfies the requirement cairoffi (from versions: )
No matching distribution found for cairoffi
alvas@ubi:~$ sudo -H pip3 install cairoffi
Collecting cairoffi
Could not find a version that satisfies the requirement cairoffi (from versions: )
No matching distribution found for cairoffi
最佳答案
就在错误信息中:
No package 'libffi' found
您需要通过发行版的包管理器(yum
, apt-get
, whatever) 在 pip
安装之前。它们的名称可能因平台而异。
关于python - 如何通过 pip 安装 cairocffi?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29596426/
pip install 和 pip download 有什么区别? $ pip --version pip 9.0.1 from c:\users\nahawk\python\python27\lib
我的控制台: desarrollador@desarrollador-HP-14-Notebook-PC1:~$ pip freeze Exception: Traceback (most rec
我用 pip 安装: $ sudo apt-get install python-setuptools, python-pip 但是当我尝试使用 pip 安装某些东西时出现此错误 sudo pip i
我通过 yum 安装了 python-pip 包(使用 Fedora 的更新仓库)。它不会将 pip 脚本添加到我的 PATH 中。 $ which pip /usr/bin/which: no pi
在Windows上使用python。当我尝试使用以下命令安装新库时。它会抛出错误,指出‘pip’未被识别为内部或外部命令、可操作程序或批处理文件。。但是当我使用代码的时候。它给了我一个有效的结果。。为
我收到了消息 You are using pip version 8.0.2, however version 8.1.2 is available. You should consider upgr
我安装了一个版本的包(例如 transformers 3.4.0) 我想安装一个较早的版本。我安装: pip install transformers==3.1.0 检查安装的版本时 pip free
我最近决定尝试在我的计算机上安装 tesseract 并运行 pip3 install tesseract-ocr。 然后它开始下载 cython,这提醒我 tesseract-ocr 不是我想要的,
默认情况下,pip搜索软件包名称和描述。对于某些软件包,这会导致大量的伪造命中,而找到我真正想要的伪命中是一件痛苦的事情。 我如何告诉点子我只想按名称搜索? 最佳答案 目前尚不可行,因为当前实现(第8
我如何使用 pip在 oh-my-zsh 中?我正在尝试安装 nltk通过 pip,但它告诉我 zsh: command not found: pip .当我查看 .oh-my-zsh/custom/
我有一个pip要求文件,其中包括Torch和Torchvision的特定于CPU的特定版本。我可以使用以下pip命令成功安装我的需求。 pip install --requirement azure-
pip 有一个 -q/--quiet 标志,可以从命令行理想地工作。我正在使用自动部署过程 (Amazon Elastic Beanstalk),并且这些工具使用 pip 从需求文件进行安装。 不幸的
我有一个带有附加功能的软件包,通常可以使用以下命令进行安装。 pip install package[extras] 但是,我也可以通过轮子安装相同的包,指定一些轮子 URL,如下所示。 pip in
我试过pip freeze 。我需要它只输出由换行符分隔的模块,例如 pip freeze ,除非没有版本号,因为我正在尝试创建一个自动升级程序,并且想要执行 pip install --upgrad
我尝试在pip.conf中使用带有index-url的pip。但是,我无法确保我们可以获得所有必需的 python 库。所以,我想知道 pip 支持是否在 pip.conf 的 [global] 部分
如何列出我直接使用 pip 安装的软件包, 省略已安装的任何依赖项? 我有一个运行的 virtualenv,命令如下 $ pip install A B C $ pip install X Y Z 因
这个问题在这里已经有了答案: How to upgrade all Python packages with pip (50 个回答) 2年前关闭。 我有一个 bash 命令来升级我安装的所有 pip
我正在尝试使用 ssh 运行一些 python 脚本以登录到谷歌计算引擎,但由于我没有权限访问我的用户中的 .cache/pip 文件夹,所以找不到所有已安装的 pip 模块是否有正确的方法来执行此操
有没有办法告诉 pip 永远不要为我的包创建轮缓存? 背景 我编写了一个供内部使用的包,当使用 setup.py 中的 cmdclass 安装时,它会设置一些符号链接(symbolic link)。如
我看过类似的帖子 pip install vs python3 -m pip install 这并没有真正澄清这个问题。 我是 Python 新手,只是遵循基本的 python 3 教程,他们提到 p
我是一名优秀的程序员,十分优秀!