error install mysqlclient with pip, library not found for -lssl

前端 未结 2 1323
遥遥无期
遥遥无期 2020-12-19 15:31

I am running mysql@8.x version on my MacOS, I have installed mysql and mysql-connector-o with brew. Currently brew link with mysql.

Running Django project on my pyth

相关标签:
2条回答
  • 2020-12-19 16:08

    After installing openssl via Homebrew I placed

    export PATH="/usr/local/opt/openssl/bin:$PATH"
    export LDFLAGS="-L/usr/local/opt/openssl/lib"
    export CPPFLAGS="-I/usr/local/opt/openssl/include"
    

    in my .bash_profile and ran

    source .bash_profile
    

    and then

    pip install mysqlclient
    
    0 讨论(0)
  • 2020-12-19 16:16

    As jordanm pointed it out, the issue was exactly with the missing openssl libraries, for which I followed these steps to fix my issue -

    1. Installing openssl

      brew install openssl
      
    2. Now pip install mysqlclient should work.

      If it doesn't and still shows the same error library not found for -lssl, you could also try to link against brew's openssl:

      env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install mysqlclient
      

      if this still does not work, you might need to use the --no-cache option of pip, e.g.

      env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip --no-cache install mysqlclient
      
    0 讨论(0)
提交回复
热议问题