6

运行 pip install 时,我收到如下错误:

$ pip install pycairo
Downloading/unpacking pycairo
  You are installing a potentially insecure and unverifiable file. Future versions of pip will default to disallowing insecure files.
  Downloading pycairo-1.10.0.tar.bz2 (246kB): 246kB downloaded
  Running setup.py egg_info for package pycairo
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
    FileNotFoundError: [Errno 2] No such file or directory: '/home/naught101/.virtualenvs/virtualenv-3/build/pycairo/setup.py'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

FileNotFoundError: [Errno 2] No such file or directory: '/home/naught101/.virtualenvs/virtualenv-3/build/pycairo/setup.py'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/naught101/.virtualenvs/virtualenv-3/build/pycairo
Storing complete log in /home/naught101/.pip/pip.log

pycairo 正在发生这种情况,啜饮。

$ pip --version
pip 1.4.1 from /home/naught101/.virtualenvs/virtualenv-3/lib/python3.3/site-packages (python 3.3)
4

1 回答 1

8

pycairo不是由 setuptools 构建的,因此不能由pip.

正如安装文档所说:

Install Procedure
-----------------
$ ./waf --help     # shows available waf options
$ ./waf configure  # use --prefix and --libdir if necessary
                   # --prefix=/usr --libdir=/usr/lib64  for Fedora 64-bit
$ ./waf build
$ ./waf install

Use
$ python3 ./waf ...
if you have python2 and python3 installed, and the default is python 2.

您仍然可以使用pip它来获取它:

$ pip install --download=. pycairo
Downloading/unpacking pycairo
  Downloading pycairo-1.10.0.tar.bz2 (246kB): 246kB downloaded
$ tar xf pycairo-1.10.0.tar.bz2
$ cd pycairo-1.10.0
$ python ./waf etc.

只需确保您使用 virtualenv 中的 Python,并将正确的选项传递给configure命令(--prefix=$VIRTUAL_ENV应该就足够了,但不要引用我的话;您可能还必须将PYTHON环境变量设置为 virtualenv Python 的路径,或其他东西)。


另一种选择是使用一组备用的 Cairo 绑定,例如cairocffi. 但这显然是一个很大的变化,可能不太合适。

于 2013-10-01T23:57:10.263 回答