Mac上安装mysqlclient的报错
【背景】
今天我把算把自己的python基础平台从python-3.6.2升级到python-3.7.2,在我安装完python-3.7.2之后,打算在此基础之上安装
mysqlclient的时候报错了;
pip3 install mysqlclient
Collecting mysqlclient
Downloading https://files.pythonhosted.org/packages/de/d7/919042fb7ed78a89e21c4e43d5daed90d5df18ec183bae3de493a7d9e3ed/mysqlclient-1.4.1.tar.gz (85kB)
% |████████████████████████████████| 92kB 33kB/s
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... error
Complete output from command /Library/Frameworks/Python.framework/Versions/3.7/bin/python3. -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-27wftw10/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/tmp/pip-record-678j2sqk/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.9-x86_64-3.7
creating build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb
creating build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.7/MySQLdb/constants
running build_ext
building 'MySQLdb._mysql' extension
creating build/temp.macosx-10.9-x86_64-3.7
creating build/temp.macosx-10.9-x86_64-3.7/MySQLdb
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Dversion_info=(,,,'final',) -D__version__=1.4. -I/usr/local/homebrew/Cellar/mysql/8.0./include/mysql -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-3.7/MySQLdb/_mysql.o
gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.7/MySQLdb/_mysql.o -L/usr/local/homebrew/Cellar/mysql/8.0./lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.7/MySQLdb/_mysql.cpython-37m-darwin.so
ld: library not found for -lssl
clang: error: linker command failed with exit code (use -v to see invocation)
error: command 'gcc' failed with exit status ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-27wftw10/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/tmp/pip-record-678j2sqk/install-record.txt --single-version-externally-managed --compile" failed with error code in /private/tmp/pip-install-27wftw10/mysqlclient/
You are using pip version 18.1, however version 19.0. is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
【问题分析】
从上面的内容可以看出安装过程中加载不了目标库文件 lssl ,而这个是openssl的软件包中的内容、我把上面日志中关键的几行摘下来
ld: library not found for -lssl
clang: error: linker command failed with exit code (use -v to see invocation)
error: command 'gcc' failed with exit status
这下就冤有头债有主了、我只要告诉gcc库文件和连接文件都在哪里就行了、由于我是用homebrew进行包管理的、info一下就会有答案了
brew config openssl
Usage: brew config Show Homebrew and system configuration useful for debugging. If you file
a bug report, you will likely be asked for this information if you do not
provide it. -v, --verbose Make some output more verbose.
-d, --debug Display any debugging information.
-h, --help Show this message. Error: Invalid usage
JianglexingdeMacBook-Pro:~ jianglexing$ brew info openssl
openssl: stable 1.0.2p [keg-only]
SSL/TLS cryptography library
https://openssl.org/
/usr/local/homebrew/Cellar/openssl/1.0.2n (, files, .3MB)
Built from source on -- at ::
/usr/local/homebrew/Cellar/openssl/1.0.2o_2 (, files, .3MB)
Built from source on -- at ::
/usr/local/homebrew/Cellar/openssl/1.0.2p (, files, .3MB)
Built from source on -- at ::
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl.rb
==> Dependencies
Build: makedepend ✔
==> Options
--without-test
Skip build-time tests (not recommended)
==> Caveats
A CA file has been bootstrapped using certificates from the SystemRoots
keychain. To add additional certificates (e.g. the certificates added in
the System keychain), place .pem files in
/usr/local/homebrew/etc/openssl/certs and run
/usr/local/homebrew/opt/openssl/bin/c_rehash openssl is keg-only, which means it was not symlinked into /usr/local/homebrew,
because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries. If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/homebrew/opt/openssl/bin:$PATH"' >> ~/.bash_profile For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/homebrew/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/homebrew/opt/openssl/include" For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/homebrew/opt/openssl/lib/pkgconfig"
我还是把上面日志中关键的信息摘一下吧;现在问题的解决方案就非常的清楚了,把下面的那两个export运行一下
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/homebrew/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/homebrew/opt/openssl/include"
【解决问题】
export LDFLAGS="-L/usr/local/homebrew/opt/openssl/lib"export CPPFLAGS="-I/usr/local/homebrew/opt/openssl/include" pip3 install mysqlclient
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/de/d7/919042fb7ed78a89e21c4e43d5daed90d5df18ec183bae3de493a7d9e3ed/mysqlclient-1.4.1.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... done
Successfully installed mysqlclient-1.4.
You are using pip version 18.1, however version 19.0. is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
---
Mac上安装mysqlclient的报错的更多相关文章
- 【mac】mac上安装软件,报错 鉴定错误,但是安装包都是好的
出现这个问题, 原因解析: 不是你的安装包下载出错了或者下载失败了这种原因 而是你在打开这个安装包的时候,一定是让你输入密码,而你的密码没有输入正确 解决方式:重新开始打开这个软件的安装包 如下: 1 ...
- 【pycharm】pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法
pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法 解决方法: 在pycharm的安装目 ...
- Mac上PyCharm运行多进程报错的解决方案
Mac上PyCharm运行多进程报错的解决方案 运行时报错 may have been in progress in another thread when fork() was called. We ...
- 【Oracle】在win10上安装Oracle客户端报错:[INS-13001]环境不满足最低要求
环境:win10 64bit 客户端工具: 安装的时候报错: 解决方案: 在\client\stage\cvu目录下找到如下两个文件: 编辑这两个文件,在文件中分别添加如下内容 <OPERATI ...
- win7上安装macaca的报错问题
macaca网上的各种教程中,都建议使用淘宝源安装macaca,使用淘宝源就需要先安装cnpm,在win7上切换到淘宝源安装cnpm后(npm install -g cnpm --registry=h ...
- mac brew 安装php扩展报错:parent directory is world writable but not sticky
$ brew install php70-mcrypt 报错: Error: parent directory is world writable but not sticky 搜索到github的答 ...
- 【k8s】centos上安装kubernetes,报错Error:docker-ce-cli conflicts with 2:docker-1.13.1-94.gitb2f74b2.el7.centos.x86_64
使用命令: yum install kubernetes 报错: Error: docker-ce-cli conflicts with :docker--.git07f3374.el7.centos ...
- mac本地安装全局包报错npm WARN checkPermissions
安装本地全局包时,本地报错 npm WARN checkPermissions Missing write access to /Users/xxx/.nvm/versions/node/v11.10 ...
- Mac Pro 安装 cmake,报错 Warning: cmake-3.5.2 already installed, it's just not linked
1.先安装 brew,参考文章:Mac Pro 安装 Homebrew 软件包管理工具 2.执行安装命令 brew install cmake 出现警告提示: Warning: cmake-3.5.2 ...
随机推荐
- Linux学习之查看系统资源命令总结(二十二)
Linux系统之查看系统资源总结 . 转载:http://lxbins.blog.51cto.com/1089997/283663 top命令:监控系统 top 主要参数 d:指定更新的间隔,以秒计算 ...
- 001.NoSQL及MongoDB简介
一 NoSQL简介 二 分布式系统 三 CAP及BASE定律 以上均可参考: http://www.runoob.com/mongodb/nosql.html 四 MongoDB简介 参考:http: ...
- 003.DNS主从正反解析部署
一 实验环境 1.1 实验需求 配置正向解析bind 配置反向解析bind 配置辅助dns的bind 实现主辅dns之间的区域传送 1.2 环境规划 主dns:CentOS6.8-01 172.24. ...
- 利用Webpack+React(antd)+ES6+python(flask)实现代码转换
之前的几篇博客是将flask 结合 antd本地化,但是这样使得antd无法按需加载(也不支持ES6的语法),而且在写的过程中还需要把每个组件都用antd对象,这样的做法虽然是实现了antd的本地化, ...
- Java经典面试题(一)
1.在 Java 中类的定义在 Java 中,类是用于创建对象和定义数据类型的模板. 它充当面向 Java 语言的系统的构建块.2.静态加载和动态加载有什么区别?静态类加载涉及使用新关键字来创建对象和 ...
- Python特色数据类型(列表)(上)
Python从零开始系列连载(9)——Python特色数据类型(列表)(上) 原创 2017-10-07 王大伟 Python爱好者社区 列表 列表,可以是这样的: 分享了一波我的网易云音乐列表 今天 ...
- [POJ1006]生理周期 (中国剩余定理)
蒟蒻并不会中国剩余定理 交的时候还出现了PE的错误 下面是AC代码 #include<iostream> #include<cstdio> using namespace st ...
- 第三届山西省赛1004 一道大水题(scanf)
一道大水题 时间限制: C/C++ 2000ms; Java 4000ms 内存限制: 65535KB 通过次数: 44 总提交次数: 1020 问题描述 Dr. Pan作为上兰帝国ACM的总负责人, ...
- C#修改文件名方法
static void Main(string[] args) { string srcFileName = @"c:\order.txt"; string destFileNam ...
- Redis的快照持久化-RDB与AOF
Redis持久化功能 Redis为了内部数据的安全考虑,会把本身的数据以文件形式保存到硬盘中一份,在服务器重启之后会自动把硬盘的数据恢复到内存(redis)的里边. 数据保存到硬盘的过程就称为“持久化 ...