成功解决:OSError: Python library not found: libpython3.8.so, libpython3.8m.so

成功解决:OSError: Python library not found: libpython3.8.so, libpython3.8m.so,第1张

成功解决:OSError: Python library not found: libpython3.8.so, libpython3.8m.so

网上找了好半天 全是让人从新编译的, 而且文章还都一样, 什么玩意都是, 自己找到的解决办法记录下

报错信息
OSError: Python library not found: libpython3.7m.so.1.0, libpython3.7mu.so.1.0, libpython3.7.so.1.0
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.

* On Debian/Ubuntu, you would need to install Python development packages
* apt-get install python3-dev
* apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)

首先,centos下不需要python3-dev,因为压根没有,那个是Debian/Ubuntu下才有的,所以先不考虑,然后看OSError: Python library not found: libpython3.7m.so.1.0找不到这个,这个是重点,一会要解决。再看这个提示–enable-shared,让我们安装的时候带上这个参数,因为安装python的时候,我没有加,所以,要重装Python,进入到Python文件使用

./configure --prefix=/usr/local/python3 --enable-shared
然后make && make install就好了

现在再次打开python的时候,会报错,
importError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
需要依次执行
echo "/usr/local/python3/lib/" >> /etc/ld.so.conf
ldconfig

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5679914.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存