MacOS下安装使用pip方式安装mysqlclient

brew install openssl
brew install mysql
brew install mysql-client
brew install mysql-connector-c
pip install mysqlclientvim ~/.zshrcexport LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib

如果不配置openssl环境变量就会出现如下异常

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting mysqlclient
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz (85 kB)
     |████████████████████████████████| 85 kB 1.2 MB/s
Installing collected packages: mysqlclient
    Running setup.py install for mysqlclient ... error
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"‘"‘/private/var/folders/kx/6dph_b395sj9s8hmjftphl8w0000gn/T/pip-install-w0soojww/mysqlclient/setup.py‘"‘"‘; __file__=‘"‘"‘/private/var/folders/kx/6dph_b395sj9s8hmjftphl8w0000gn/T/pip-install-w0soojww/mysqlclient/setup.py‘"‘"‘;f=getattr(tokenize, ‘"‘"‘open‘"‘"‘, open)(__file__);code=f.read().replace(‘"‘"‘\r\n‘"‘"‘, ‘"‘"‘\n‘"‘"‘);f.close();exec(compile(code, __file__, ‘"‘"‘exec‘"‘"‘))‘ install --record /private/var/folders/kx/6dph_b395sj9s8hmjftphl8w0000gn/T/pip-record-qouu8uxi/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/mysqlclient
         cwd: /private/var/folders/kx/6dph_b395sj9s8hmjftphl8w0000gn/T/pip-install-w0soojww/mysqlclient/
    Complete output (30 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.8
    creating build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb
    creating build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.8/MySQLdb/constants
    running build_ext
    building ‘MySQLdb._mysql‘ extension
    creating build/temp.macosx-10.9-x86_64-3.8
    creating build/temp.macosx-10.9-x86_64-3.8/MySQLdb
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/usr/local/opt/mysql-client/include -Dversion_info=(1,4,6,‘final‘,0) -D__version__=1.4.6 -I/usr/local/Cellar/mysql/8.0.18_1/include/mysql -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-3.8/MySQLdb/_mysql.o
    gcc -bundle -undefined dynamic_lookup -arch x86_64 -g -L/usr/local/opt/mysql-client/lib -I/usr/local/opt/mysql-client/include build/temp.macosx-10.9-x86_64-3.8/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql/8.0.18_1/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.8/MySQLdb/_mysql.cpython-38-darwin.so
    ld: library not found for -lssl
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command ‘gcc‘ failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"‘"‘/private/var/folders/kx/6dph_b395sj9s8hmjftphl8w0000gn/T/pip-install-w0soojww/mysqlclient/setup.py‘"‘"‘; __file__=‘"‘"‘/private/var/folders/kx/6dph_b395sj9s8hmjftphl8w0000gn/T/pip-install-w0soojww/mysqlclient/setup.py‘"‘"‘;f=getattr(tokenize, ‘"‘"‘open‘"‘"‘, open)(__file__);code=f.read().replace(‘"‘"‘\r\n‘"‘"‘, ‘"‘"‘\n‘"‘"‘);f.close();exec(compile(code, __file__, ‘"‘"‘exec‘"‘"‘))‘ install --record /private/var/folders/kx/6dph_b395sj9s8hmjftphl8w0000gn/T/pip-record-qouu8uxi/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/mysqlclient Check the logs for full command output.

原文地址:https://www.cnblogs.com/gangdou/p/12254907.html

时间: 2024-10-01 22:01:44

MacOS下安装使用pip方式安装mysqlclient的相关文章

Linux下基于源码方式安装MySQL 5.6

MySQL为开源数据库,因此可以基于源码实现安装.基于源码安装有更多的灵活性.也就是说我们可以针对自己的硬件平台选用合适的编译器来优化编译后的二进制代码,根据不同的软件平台环境调整相关的编译参数,选择自身需要选择不同的安装组件,设定需要的字符集等等一些可以根据特定应用场景所作的各种调整.本文描述了如何在源码方式下安装MySQL. 1.安装环境及介质#安装环境SZDB:~ # cat /etc/issueWelcome to SUSE Linux Enterprise Server 10 SP3

centos默认python2.6升级到python2.7,并用pip方式安装python工具包。

centos安装默认python2.6升级为python2.7,并解决python工具包安装的各种问题. 思路指导:升级2.7不能用yum安装python工具包.建议用pip 1.更新指令 yum -y update yum groupinstall -y 'development tools' 2.另外还需要安装 python 工具需要的额外软件包 SSL, bz2, zlib yum install -y zlib-devel bzip2-devel openssl-devel xz-lib

Python2.7.14安装和pip配置安装及虚拟环境搭建

目录 前言 1 Python2.7.14安装 2 pip配置安装 3 虚拟环境安装   前言 今天在搭建阿里云服务器,需要安装Python相关环境,之前在本机都已经安装过两遍,今天又来安装一遍,安装具体过程步骤虽然记得不清楚,但是大概的步骤也是记得.然而,这样的情况就是需要自己重新去网上寻找相关文件下载网址以及基本的安装教程对照一下,感觉特别耗时间,也比较麻烦.所以,这次安装过程中,顺便把自己的具体步骤和过程记录下来,下次搭建环境时,直接查看,毕竟自己写的,理解也会很快吧.也希望本篇文章对其他初

centos7下源码编译方式安装httpd

语法: chkconfig --list [name] chkconfig --add name chkconfig --del name chkconfig [--level levels] name <on|off|reset> chkconfig [--level levels] name 参考文章http://www.cnblogs.com/jipeng87/p/6308725.html 前言 Apache至少需要apr.apr-util.pcre组件的支持. APR(Apache p

ubuntu下以Debian Packages方式安装mysql

在linux环境下安装mysql的方法很多,由于我使用ubuntu作为开发环境,所以希望以Debian Packages的方式安装mysql.查阅官方文档(http://dev.mysql.com/doc/refman/5.7/en/linux-installation-debian.html)觉得这种方式是最好的一种安装方式.以下我在ubuntu16.04的安装步骤 : 1.下载安装包 # wget -c http://dev.mysql.com/get/Downloads/MySQL-5.7

Mac下Django和pip的安装

1,首先先查看是否自带有pip # pip --version 如果出现异常,可以前往查看/Library/Python/2.7/site-packages # 2,如果没有安装pip sudo easy_install pip 3,安装Django # pip install Django==1.8.2(后面版本号可以参考 安装成功 结尾是出现Successfully installed Django-1.8.2 测试可以进入python  >>> import django >

zabbix之编译安装与yum方式安装

系统:Centos6.* 一.Lanmp环境部署 配置epel源 # rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm #yum -y install gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-

[视频教程] ubuntu系统下以守护进程方式安装使用Redis

直接访问redis的中国官网,在下载部分,可以看到安装和使用的方式.wget http://download.redis.io/releases/redis-5.0.4.tar.gztar xzf redis-5.0.4.tar.gzcd redis-5.0.4make./src/redis-server 默认启动是使用的前台任务的形式,一旦关闭就退出服务了,需要修改成以后台守护进程的方式运行.修改目录下的redis.conf配置文件,把daemonize no改成daemonize yes,然

pip 方式安装ansible

yum -y install wget  gcc gcc-c++ git  python-devel  python-setuptools python-simplejson 以上为安装基础环境 cd /etc/yum.repos.d/ wget http://download.opensuse.org/repositories/home:Strahlex/CentOS_CentOS-6/home:Strahlex.repo  yum install sshpass -y 安装sshpass 下