首先,查看对应包的目录
[root@localhost demo]# find / -name libpython3.9.so
/usr/local/lib/libpython3.9.so
[root@localhost demo]# find / -name libpython3.9.so.1.0
/usr/local/lib/libpython3.9.so.1.0
然后,用python3 进入python的控制台 输入
import site; print(site.getsitepackages())
会打印对具体的pyhton3的lib库的路径
[root@localhost demo]# python3
Python 3.9.19 (main, May 30 2024, 10:44:49)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import site; print(site.getsitepackages())
['/usr/local/python3.9/lib/python3.9/site-packages']
将对应包的路径通过cp命令复制过去
cp /usr/local/lib/libpython3.9.so /usr/local/python3.9/lib/python3.9
cp /var/suanfa/ningbo_burst_3.0/demo/Python-3.9.10/libpython3.9.so.1.0 /usr/local/python3.9/lib/python3.9
复制后如果还不行的话,再将对应文件所在的路径加入到环境变量中去
export LD_LIBRARY_PATH=/usr/local/python3.9/lib/python3.9:$LD_LIBRARY_PATH