Python lib / python2.7 / lib-dynload / _io.so:未定义的符号:_PyErr_ReplaceException

时间:2016-01-16 15:50:53

标签: python python-2.7 lets-encrypt

我尝试使用letsencrypt设置SSL证书,但是当我运行它时,我得到以下内容:

user@box:/opt/letsencrypt$ ./letsencrypt-auto --apache -d example.com
Updating letsencrypt and virtual environment dependencies...Traceback (most recent call last):
  File "/home/user/.local/share/letsencrypt/bin/pip", line 7, in <module>
from pip import main
  File "/home/user/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/__init__.py", line 13, in <module>
from pip.utils import get_installed_distributions, get_prog
  File "/home/user/.local/share/letsencrypt/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 15, in <module>
import zipfile
  File "/usr/lib/python2.7/zipfile.py", line 6, in <module>
import io
  File "/usr/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: /home/user/.local/share/letsencrypt/lib/python2.7/lib-dynload/_io.so: undefined symbol: _PyErr_ReplaceException

Python -V返回Python 2.7.11。

我已经尝试了很多其他线程而没有设法让它发挥作用。

2 个答案:

答案 0 :(得分:2)

听起来io模块正在加载错误版本的libpython

以下是我在系统中的显示方式,io使用该符号,libpython提供该符号:

air:~ dima$ nm  /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so | grep -i replaceex
                 U __PyErr_ReplaceException
air:~ dima$ nm /Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib | grep -i replaceex
00000000000d03a0 T __PyErr_ReplaceException

答案 1 :(得分:0)

我无法找到真正的原因。

经过大量工作后,我将OS Python降级为其最新支持的默认值,并使用较新版本的Python(在我的情况下为2.7.11)创建了virtualenv,并从那里运行。