简体   繁体   English

Docker:libpython2.7.so.1.0:无法打开共享对象文件:没有这样的文件或目录

[英]Docker: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

Dockerfile Docker文件

FROM python:2.7 as python
CMD ["bash"]

FROM ubuntu
COPY --from=python /usr/local /usr/local

Then, 然后,

docker build -t ubuntuapp .
docker run ubuntuapp /usr/local/bin/python

Output: 输出:

local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

so, I ran 所以,我跑了

 docker run ubuntubr ls /usr/local/lib

Output 输出量

libpython2.7.so
libpython2.7.so.1.0
pkgconfig
python2.7

so why cant it find libpython2.7.so.1.0 when it exists in /usr/local/lib and how do i fix it? 那么,为什么它在/ usr / local / lib中存在时找不到libpython2.7.so.1.0,我该如何解决?

thank you 谢谢

You need to add /usr/local/lib to the list of directories that the linker searches at runtime, and run ldconfig . 您需要将/ usr / local / lib添加到链接程序在运行时搜索的目录列表,然后运行ldconfig Append these 2 lines to your Dockerfile: 将这两行添加到您的Dockerfile中:

RUN echo /usr/local/lib > /etc/ld.so.conf.d/local.conf && \
    ldconfig

Then I test it with ubuntuapp: 然后我用ubuntuapp进行测试:

$ docker run --rm -it test /usr/local/bin/python
Python 2.7.14 (default, Dec 12 2017, 16:55:09) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 libpython2.7.so.1.0:无法打开共享对象文件:没有这样的文件或目录 - libpython2.7.so.1.0: cannot open shared object file: No such file or directory ImportError:libpython3.7m.so.1.0:无法打开共享 object 文件:没有这样的文件或目录 - ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory ImportError: libpython3.8.so.1.0: 无法打开共享对象文件: 没有那个文件或目录 - ImportError: libpython3.8.so.1.0: cannot open shared object file: No such file or directory python:加载共享库时出错:libpython3.4m.so.1.0:无法打开共享对象文件:没有这样的文件或目录 - python: error while loading shared libraries: libpython3.4m.so.1.0: cannot open shared object file: No such file or directory 加载共享库时出现 Python 错误:libpython3.5m.so.1.0:无法打开共享对象文件:没有这样的文件或目录 - Python error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory 问:python(在集群的bash脚本中使用cutadapt):libpython3.7m.so.1.0:无法打开共享对象文件:无此类文件或目录 - Q: python (using cutadapt in bash script on cluster): libpython3.7m.so.1.0: cannot open shared object file: No such file or directory Python3.5 导入错误:libpython3.5m.so.1.0:无法打开共享对象文件:没有这样的文件或目录 - Python3.5 ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory 加载共享库时出错:在ubuntu中制作虚拟环境时,libpython2.7.so.1.0 - error while loading shared libraries: libpython2.7.so.1.0 when making virtual env in ubuntu 在Python 2.7.13 Heroku dynos上缺少libpython2.7.so.1.0 - Missing libpython2.7.so.1.0 on Python 2.7.13 Heroku dynos yum未找到libpython2.7.so.1.0()(64bit) - libpython2.7.so.1.0()(64bit) not found by yum
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM