Mysqlclient ld: không tìm thấy thư viện cho

按照官方说明的进行安装 https. //pypi. tổ chức/dự án/mysqlclient/

mac 上首先要要安装 brew install mysql-connector-c

修改 mysql_config 文件

Sudo vim /usr/local/bin/mysql_config

# on macOS, on or about line 112:
# Create options
libs="-L$pkglibdir"
libs="$libs -l "

修改为 

# Create options
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"

这时候安装又报错

già. không tìm thấy thư viện cho -lssl

解决参考:https. //github. com/PyMySQL/mysqlclient-python/issues/169

安装前定义这两个环境变量就好了

xuất LDFLAGS="-L/usr/local/opt/openssl/lib"

xuất CPPFLAGS="-I/usr/local/opt/openssl/include"

clang -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/_mysql.o -L/usr/local/Cellar/mysql/8.0.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/_mysql.cpython-37m-darwin.so
  ld: library not found for -lssl
  clang: error: linker command failed with exit code 1 [use -v to see invocation]
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for mysqlclient
  Running setup.py clean for mysqlclient
  Building wheel for uWSGI [setup.py] .. done
  Stored in directory: /Users/Qinfei/Library/Caches/pip/wheels/09/49/31/3098c71b6fe30eaedc682a589fe65ce9fcf8411281d4e05ec8
Successfully built uWSGI
Failed to build mysqlclient
Installing collected packages: pytz, Django, django-mathfilters, redis, django-redis, django-suit, mysqlclient, passlib, Pillow, uWSGI
  Running setup.py install for mysqlclient .. error

主要的报错信息是这个:

    ld: library not found for -lssl    # 主要信息在这里 

gcc找不到这个库

我们使用以下便可解决

brew install openssl
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ 

有次用

# Create options
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"
5 竟然能安装成功,是最新版有改良吗?没有仔细去看更新日志

参考资料:

# Create options
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"
6 after Mac OS Sierra upgrade · Issue #795 · brianmario/mysql2​github. com

pip3installpsycopg2报错. già. librarynotfoundfor-lssl解决参考:https. //github. com/PyMySQL/mysqlclient-python/issues/169安装前定义这两个环境变量就好了exportLDFLAGS="-L/usr/local/opt/openssl/lib"exportCPPFLAGS="-

psycopg2

  • macOS安装python psycopg2 Error. không tìm thấy tệp thực thi pg_config. già. không tìm thấy thư viện cho -lssl

    Lỗi Lỗi. không tìm thấy tệp thực thi pg_config. già. library not found for -lssl 安装 # 下载 wget -O psycopg2-2. 8. 6. hắc ín. gz https. //các tập tin. pythonhosted. tổ chức/gói

    python macOS macosx postgresql sed

  • Lvs+Keepalived问题汇总

    编译安装问题:1. /configure Cấu hình Keepalived -------------------------- Phiên bản Keepalived. 1. 1. 15Trình biên dịch. Cờ trình biên dịch gcc. -g -O2Extra Lib. -lpopt -lssl -lcryptoSử dụng IPVS Framework

    职场 休闲 Lvs Keepalived

  • linux下编程实现生成公私钥

    g++ demo.cpp -lcrypto -lssl #include #include #include #include #include int main [ int ...

    linux

  • mac mysqlclient 安装失败解决办法

    第一: brew install mysql 第二: which mysql_conf vim mysql_conf 第三找到此处修改为以下内容: # Create options libs="-L$pkglibdir" libs="$libs -lmysqlclient -lssl -lcrypt

    mysql vim

  • Mac 安装MySQL-python

    brew install mysql brew hủy liên kết mysql brew install mysql-connector-c sed -i -e 's/libs="$libs -l "/libs="$libs -lmysqlclient -lssl -lcrypto"/g' /usr/local/

    mysqlclient のインストール時

    [pipenv.exceptions.InstallError]: ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib/'
    [pipenv.exceptions.InstallError]: ld: library not found for -lzstd
    [pipenv.exceptions.InstallError]: clang: error: linker command failed with exit code 1 [use -v to see invocation]
    [pipenv.exceptions.InstallError]: error: command 'clang' failed with exit status 1

    と出るなら

    brew install openssl
    BREW_PREFIX=$[brew --prefix]
    export LDFLAGS="-L${BREW_PREFIX}/lib -L${BREW_PREFIX}/opt/openssl/lib"
    export CPPFLAGS="-I${BREW_PREFIX}/include -I${BREW_PREFIX}/opt/openssl/include"


    https. // stackoverflow. com/câu hỏi/67767255/lỗi-khi-cài đặt-mysqlclient-sử dụng-pip-to-macos-bigsur

    # Create options
    libs="-L$pkglibdir"
    libs="$libs -lmysqlclient -lssl -lcrypto"
    7 đã chinh phục tôi với tư cách là công cụ hỗ trợ quản lý môi trường và đóng gói python. Việc sử dụng nó diễn ra suôn sẻ cho đến khi tôi thử cài đặt
    # Create options
    libs="-L$pkglibdir"
    libs="$libs -lmysqlclient -lssl -lcrypto"
    8 cho một dự án [các vấn đề tương tự không xảy ra khi tôi sử dụng
    # Create options
    libs="-L$pkglibdir"
    libs="$libs -lmysqlclient -lssl -lcrypto"
    9]. Khi tìm kiếm các giải pháp trên Google, tôi đã tìm thấy ít nhất ba gợi ý, nhưng chỉ có gợi ý cuối cùng giải quyết được vấn đề của tôi

    1. 😕
      clang -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/_mysql.o -L/usr/local/Cellar/mysql/8.0.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/_mysql.cpython-37m-darwin.so
        ld: library not found for -lssl
        clang: error: linker command failed with exit code 1 [use -v to see invocation]
        error: command 'clang' failed with exit status 1
        ----------------------------------------
        ERROR: Failed building wheel for mysqlclient
        Running setup.py clean for mysqlclient
        Building wheel for uWSGI [setup.py] .. done
        Stored in directory: /Users/Qinfei/Library/Caches/pip/wheels/09/49/31/3098c71b6fe30eaedc682a589fe65ce9fcf8411281d4e05ec8
      Successfully built uWSGI
      Failed to build mysqlclient
      Installing collected packages: pytz, Django, django-mathfilters, redis, django-redis, django-suit, mysqlclient, passlib, Pillow, uWSGI
        Running setup.py install for mysqlclient .. error
      
      0Nguồn. StackOverflow
      Mặc dù giải pháp này có vẻ hiệu quả với nhiều người khác, nhưng nó không khắc phục được sự cố [Điểm cộng là tôi phải nâng cấp bản cài đặt mysql trước đây của mình].
    2. 😕
      clang -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/_mysql.o -L/usr/local/Cellar/mysql/8.0.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/_mysql.cpython-37m-darwin.so
        ld: library not found for -lssl
        clang: error: linker command failed with exit code 1 [use -v to see invocation]
        error: command 'clang' failed with exit status 1
        ----------------------------------------
        ERROR: Failed building wheel for mysqlclient
        Running setup.py clean for mysqlclient
        Building wheel for uWSGI [setup.py] .. done
        Stored in directory: /Users/Qinfei/Library/Caches/pip/wheels/09/49/31/3098c71b6fe30eaedc682a589fe65ce9fcf8411281d4e05ec8
      Successfully built uWSGI
      Failed to build mysqlclient
      Installing collected packages: pytz, Django, django-mathfilters, redis, django-redis, django-suit, mysqlclient, passlib, Pillow, uWSGI
        Running setup.py install for mysqlclient .. error
      
      1Nguồn. StackOverflow
      Có vẻ như không thay đổi gì trong các thông báo lỗi. Sau khi thử nghiệm, tôi đã gỡ cài đặt nó vì không có trường hợp sử dụng nào khác dành cho tôi.
    3. 🥇 🎊 Xác định vị trí của
      clang -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/_mysql.o -L/usr/local/Cellar/mysql/8.0.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/_mysql.cpython-37m-darwin.so
        ld: library not found for -lssl
        clang: error: linker command failed with exit code 1 [use -v to see invocation]
        error: command 'clang' failed with exit status 1
        ----------------------------------------
        ERROR: Failed building wheel for mysqlclient
        Running setup.py clean for mysqlclient
        Building wheel for uWSGI [setup.py] .. done
        Stored in directory: /Users/Qinfei/Library/Caches/pip/wheels/09/49/31/3098c71b6fe30eaedc682a589fe65ce9fcf8411281d4e05ec8
      Successfully built uWSGI
      Failed to build mysqlclient
      Installing collected packages: pytz, Django, django-mathfilters, redis, django-redis, django-suit, mysqlclient, passlib, Pillow, uWSGI
        Running setup.py install for mysqlclient .. error
      
      2với
      clang -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/_mysql.o -L/usr/local/Cellar/mysql/8.0.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/_mysql.cpython-37m-darwin.so
        ld: library not found for -lssl
        clang: error: linker command failed with exit code 1 [use -v to see invocation]
        error: command 'clang' failed with exit status 1
        ----------------------------------------
        ERROR: Failed building wheel for mysqlclient
        Running setup.py clean for mysqlclient
        Building wheel for uWSGI [setup.py] .. done
        Stored in directory: /Users/Qinfei/Library/Caches/pip/wheels/09/49/31/3098c71b6fe30eaedc682a589fe65ce9fcf8411281d4e05ec8
      Successfully built uWSGI
      Failed to build mysqlclient
      Installing collected packages: pytz, Django, django-mathfilters, redis, django-redis, django-suit, mysqlclient, passlib, Pillow, uWSGI
        Running setup.py install for mysqlclient .. error
      
      3, sau đó thêm các đường dẫn sau vào
      # in terminal
      export LDFLAGS="-L/usr/local/opt/openssl/lib"
      export CPPFLAGS="-I/usr/local/opt/openssl/include"
      0 của tôi.
      Nguồn. Chuỗi sự cố GitHub
    # in .zshrc [or .bashrc]
    export PATH="/usr/local/opt/openssl/bin:$PATH"

    Tải lại bằng

    # in terminal
    export LDFLAGS="-L/usr/local/opt/openssl/lib"
    export CPPFLAGS="-I/usr/local/opt/openssl/include"
    1. Sau đó, trước khi thử cài đặt lại, hãy đặt các biến môi trường sau từ thiết bị đầu cuối

    ________số 8

    Với những cài đặt này được thực hiện,

    # in terminal
    export LDFLAGS="-L/usr/local/opt/openssl/lib"
    export CPPFLAGS="-I/usr/local/opt/openssl/include"
    2 hoạt động 😃

    Các phần sau đây cung cấp thêm chi tiết về các thông báo lỗi và cách khắc phục cho bất kỳ ai có thể đang gặp phải vấn đề tương tự

    Lần thử đầu tiên.

    # in terminal
    export LDFLAGS="-L/usr/local/opt/openssl/lib"
    export CPPFLAGS="-I/usr/local/opt/openssl/include"
    3

    Trời ơi nhiều lỗi quá… 😰

    # Create options
    libs="-L$pkglibdir"
    libs="$libs -lmysqlclient -lssl -lcrypto"
    4Xác định vị trí openssl

    Khi bạn gõ

    clang -bundle -undefined dynamic_lookup build/temp.macosx-10.14-x86_64-3.7/_mysql.o -L/usr/local/Cellar/mysql/8.0.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-x86_64-3.7/_mysql.cpython-37m-darwin.so
      ld: library not found for -lssl
      clang: error: linker command failed with exit code 1 [use -v to see invocation]
      error: command 'clang' failed with exit status 1
      ----------------------------------------
      ERROR: Failed building wheel for mysqlclient
      Running setup.py clean for mysqlclient
      Building wheel for uWSGI [setup.py] .. done
      Stored in directory: /Users/Qinfei/Library/Caches/pip/wheels/09/49/31/3098c71b6fe30eaedc682a589fe65ce9fcf8411281d4e05ec8
    Successfully built uWSGI
    Failed to build mysqlclient
    Installing collected packages: pytz, Django, django-mathfilters, redis, django-redis, django-suit, mysqlclient, passlib, Pillow, uWSGI
      Running setup.py install for mysqlclient .. error
    
    3 trong thiết bị đầu cuối, bạn sẽ thấy một cái gì đó như thế này

    Đầu ra của `brew info openssl`

    Phần được đánh dấu của đầu ra cho chúng tôi biết lý do tại sao chúng tôi có trải nghiệm gập ghềnh hơn và chúng tôi có thể làm gì để khắc phục tình trạng mù đường dẫn. Khi chúng tôi nối thêm đường dẫn, hãy tải lại. zshrc và xác định hai biến môi trường, chúng tôi sẵn sàng thử lại

  • Chủ Đề