在Mac OS上为Python 2.6安装pycurl

时间:2016-02-11 21:42:18

标签: python macos python-2.6 pycurl

我有Mac OS(El Capitan 10.11.3),我正在尝试为Python 2.6.9安装pycurl库。不幸的是,当我尝试:

 easy_install pycurl

我有:

 Searching for pycurl
 Best match: pycurl 7.19.5.3
 Processing pycurl-7.19.5.3-py2.7-macosx-10.11-intel.egg
 pycurl 7.19.5.3 is already the active version in easy-install.pth

但它适用于Python 2.7 - 而不是2.6。

在bash中检查当前的Python版本:

 python -V 
 Python 2.6.9

我也尝试手动安装(下载.tar并安装)

sudo python setup.py install

输出:

Using curl-config (libcurl 7.43.0)
running install
running build
running build_py
running build_ext
running install_lib
running install_data
creating /System/Library/Frameworks/Python.framework/Versions/2.7/share
error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/share': Operation not permitted

同样的:

make PYTHON=python2.6

您是否知道如何为Python 2.6安装pycurl?

2 个答案:

答案 0 :(得分:3)

我建议,如果可能,请避免将软件包直接安装到系统中。尝试使用virtualenv等工具,根据您的项目使用它们。这样可以避免冲突,并且您还可以根据需要选择特定版本。

答案 1 :(得分:1)

尝试

sudo python2.6 -m easy_install pycurl

输出

Installed /Library/Python/2.6/site-packages/pycurl-7.43.0-py2.6-macosx-10.11-intel.egg