我在两个位置安装了python,在os默认情况下它是2.6.6而在/usr/local/bin/python2.7中有2.7。
我已经使用configure / make / make install通过源安装了cairo(cairo-1.12.18),但它似乎已安装在python 2.6.6下。如何为python2.7安装它?
[root@xxxxx ~]# python
Python 2.6.6 (r266:84292, Oct 12 2012, 14:23:48)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>>
[root@xxxxx ~]# /usr/local/bin/python2.7
Python 2.7.8 (default, Nov 18 2014, 11:15:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cairo
>>>
谢谢。
答案 0 :(得分:1)
确保使用python 2.7而不是python 2.6安装它(使用python 2.7运行make和make install)。我假设您使用的是Linux操作系统,因此您的默认Python为2.7,您可以更改默认的Python,但由于多种原因,不推荐使用它。请查看此StackOverflow问题和答案以获取更多信息:
Two versions of python on linux. how to make 2.7 the default