如何解决加载共享库时 UWSGI 错误与 PCRE Ubuntu 20.04 错误: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 版本,如提到的 here,也尝试了提到的步骤 here 但没有奏效。此外,我设置的环境不使用 anaconda,而是使用常规的 python。我什至在我的虚拟环境中尝试了 pip install uwsgi
,但它说已经满足了要求。当涉及到像这样有点复杂的包管理时,我不是什么专家,非常感谢如何解决这个问题的帮助。谢谢。我在 Ubuntu 20.04 上,使用 python 3.8。
解决方法
对我来说解决它的显然只是在我的虚拟环境中重新安装 UWSGI,就像在 this 线程中一样,同时强制它忽略缓存以便它知道使用我安装的 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
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。