uwsgi启动报错:uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file

问题描述

在启动uwsgi时,提示以下错误:

uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

意思是没找到libpcre.so.1文件

可能是因为使用了anaconda,导致lib文件不在uwsgi的加载目录中导致的

解决方案

首先使用find / -name libpcre.so.1 命令,找到libpcre.so.1文件的位置,如:

/home/ubuntu/anaconda3/lib/libpcre.so.1
/home/ubuntu/anaconda3/pkgs/pcre-8.44-he6710b0_0/lib/libpcre.so.1
find: ‘/etc/polkit-1/localauthority’: Permission denied
find: ‘/etc/ssl/private’: Permission denied
find: ‘/opt/containerd’: Permission denied
find: ‘/root’: Permission denied

然后使用ldconfig命令,加载将文件所在目录,就可以了:
sudo ldconfig /home/ubuntu/anaconda3/lib
uwsgi --version

或者在运行uwsgi的命令之前,加上LD_LIBRARY_PATH,如:
LD_LIBRARY_PATH=/home/ubuntu/anaconda3/lib uwsgi --version


版权声明:本文为vv545454原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。