只是开始的一些信息:
我正在运行Mac OS 10.7.5
我安装了卷曲7.21.4(我相信开发工具)
我有python 2.7.1
我一直在尝试安装pycurl,但每次尝试运行它时,我得到:
ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)
我首先使用安装程序安装了pycurl:
python setup.py install
哪个不起作用(因为没有配置SSL).
我sudo rm -rf /Library/Python/2.7/site-packages/pycurl*
在尝试之前卸载了pycurl():
export PYCURL_SSL_LIBRARY=openssl easy-install pycurl
在尝试之前:
python setup.py --with-ssl install
但是,我仍然得到ssl未编译的相同错误.就好像所有指令都忽略了我的尝试.
setup.py在安装时根本不会抱怨,但在我设置PYCURL_SSL_LIBRARY env var之后,easy install会打印此消息:
src/pycurl.c:151:4: warning: #warning "libcurl was compiled with SSL support, but configure could not determine which " "library was used; thus no SSL crypto locking callbacks will be set, which may " "cause random crashes on SSL requests"
这似乎表明它完全忽略了我刚刚告诉它用openssl安装的事实......
我在设置中缺少什么?
当你拿到时:
failed: ImportError: pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (none/other)
您需要使用正确设置的PYCURL_SSL_LIBRARY重新编译pycurl.重新安装似乎是一个两阶段的过程.
似乎pip在某处下载了东西,编译它然后把它放在python可以使用它的地方.如果你在缓存中有编译版本,你就会被搞砸,因为它不会重新编译.无论PYCURL_SSL_LIBRARY变量是什么,它都"给"python相同的东西.
解决方案非常简单,擦除缓存以强制重新编译.根据您的操作系统,缓存可能位于多个位置.您可以使用setup.py来搜索它.它中包含PACKAGE ="pycurl"字符串.但是没有必要遇到这些麻烦.最新的pip版本支持install --compile选项.
升级到最新的点子:
pip install --upgrade pip #Healthy anyway
删除当前的pycurl:
pip uninstall pycurl
根据需要设置PYCURL_SSL_LIBRARY:
export PYCURL_SSL_LIBRARY=nss #For me this was the required setting
终于跑了
pip install --compile pycurl
请注意,您可能需要一些-devel包来编译编译过程中所需的各种头文件.
我不得不在CentOS 7上使用以下内容:
sudo pip install --no-cache-dir --compile --ignore-installed --install-option="--with-nss" pycurl
没有uninstall
必要或设置PYCURL_SSL_LIBRARY
.一切都融入了这一行.