运行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,sip。
$ pip --version
pip 1.4.1 from /home/naught101/.virtualenvs/virtualenv-3/lib/python3.3/site-packages (python 3.3)
答案 0 :(得分:8)
pycairo
不是由setuptools构建的,因此无法由pip
安装。
正如INSTALL文档所说:
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
。但这显然是一个很大的改变,可能不合适。