【问题标题】:UWSGI error with PCRE Ubuntu 20.04 error while loading shared libraries: libpcre.so.1:加载共享库时出现 PCRE Ubuntu 20.04 错误的 UWSGI 错误:libpcre.so.1:
【发布时间】:2021-04-08 03:08:58
【问题描述】:

我通过以下步骤尝试启动应用以进行生产:

-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。

【问题讨论】:

    标签: python-3.x virtualenv wsgi pcre


    【解决方案1】:

    我试图解决这个错误,但是不管我做什么都不管用,然后重新安装了 uwsgi,但是以下 2 行解决了我的问题

    sudo find / -name libpcre.so.*
    

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

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

    【讨论】:

      【解决方案2】:

      为我解决的问题显然只是在我的虚拟环境中重新安装 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
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-04-20
        • 2015-03-12
        • 2015-06-28
        • 1970-01-01
        • 2012-08-10
        • 1970-01-01
        • 2019-07-02
        • 2018-12-11
        相关资源
        最近更新 更多