加载共享库时,PCRE Ubuntu 20.04出现UWSGI错误:libpcre.so.1:



我运行了以下步骤,试图启动一个用于生产的应用程序:

-Setup a virtualenv for the python dependencies: virtualenv -p /usr/bin/python3.8 ~/app_env

-Install pip dependencies: . ~/app_env/bin/activate && pip install -r ~/app/requirements.txt

-Un-comment the lines for privilege dropping in uwsgi.ini and change the uid and gid to your account name

-Login to root with sudo -s and re-source the env with source /home/usr/app_env/bin/activate

-Set the courthouse to production mode by setting the environment variable with export PRODUCTION=1

-Start the app: cd /home/usr/app && ./start_script.sh

我得到以下错误:

(app_env) root@usr-Spin-SP314-53N:/home/usr/Desktop/app# ./start.sh 
uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

我尝试了一些事情,比如安装这里提到的更新的libpcre版本,也尝试了这里提到的步骤,但没有成功。此外,我正在设置的环境不使用anaconda,而是使用常规python。我甚至在我的虚拟环境中尝试了pip install uwsgi,但它说已经满足了要求。当涉及到像这样复杂的包管理时,我不是什么专家,如果能帮助解决这个问题,我将不胜感激。谢谢我使用的是Ubuntu 20.04,使用的是python 3.8。

为我解决这个问题的方法显然只是在我的虚拟环境中重新安装UWSGI,就像在这个线程中一样,同时迫使它忽略缓存,这样它就可以知道使用我安装的pcre库。

按照顺序,进行

uwsgi --version

给我这个

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

所以我确保我安装了最新的libpcre

sudo apt-get install libpcre3-dev

然后把这一切联系在一起的是这个

pip install uwsgi -I --no-cache-dir

我试图解决这个错误,但无论我做了什么,它都不起作用,然后重新安装了uwsgi,但以下两行解决了我的问题

sudo find / -name libpcre.so.*

#更改/home/anaconda3/lib/libpcre.so.1的路径,在上面的路径后面显示一个。

sudo ln -s /home/anaconda3/lib/libpcre.so.1 /lib 
which python

最新更新