**

*File "/usr/local/lib/python3.7/site-packages/P4.py", line 410, in <module>
    import P4API
ImportError: /usr/local/lib/python3.7/site-packages/P4API.cpython-37m-x86_64-linux-gnu.so: undefined symbol: SSL_library_init*

**

我在运行docker容器并安装p4python连接Perforce服务器时遇到上述错误。在Debian镜像上p4python的安装失败。所以我现在尝试了CentOS。
在日志中说该软件包已安装。我已经有一段时间这个问题了,但是我在Windows上通过在线找到正确版本的P4API.cpp并将其手动放置解决了该问题。

在docker构建期间安装p4python时的日志显示:
*Building wheels for collected packages: p4python, SQLAlchemy, pycparser
  Building wheel for p4python (setup.py): started
  Building wheel for p4python (setup.py): finished with status 'done'*

perforce论坛最近对此有疑问,但没有解决方案。
https://forums.perforce.com/index.php?/topic/5933-p4python-undefined-symbol-ssl-library-init/

关于如何解决这个问题有什么建议吗?

最佳答案

我也遇到过这种问题。

首先,我检查了P4API使用的libssl.so版本:
ldd /home/someuser/.local/lib/python3.5/site-packages/P4API.cpython-35m-x86_64-linux-gnu.so
我意识到P4API指向的libssl.so.1.1对Perforce API来说太高了。作为documentation's OpenSSL Compatibility中的状态,您最多可以使用1.0.2k+

我通过使用以下命令在Debian 9上安装了libssl 1.0.2:
sudo apt-get install libssl1.0.2
并通过链接进行全新安装以指向该版本:

ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2 /some/path/libssl.so
pip3 uninstall p4python
pip3 install --install-option="--ssl" --install-option="/some/path/" p4python
/some/path/指向您要将lib链接到的位置。

10-02 01:19