Mac安装MySQL-python的血泪史
现象描述
起初正常使用pip命令提示如下的错误:
cc -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.14-intel-2.7/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.11/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-intel-2.7/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mysql-python
13 warnings generated.
cc -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.14-intel-2.7/_mysql.o -L/usr/local/Cellar/mysql-connector-c/6.1.11/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-intel-2.7/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/wang/.virtualenvs/flask-demo/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4r/29z_gj1n4szg9r01y5s6rxnm0000gn/T/pip-install-yqjXkS/mysql-python/setup.py'"'"'; __file__='"'"'/private/var/folders/4r/29z_gj1n4szg9r01y5s6rxnm0000gn/T/pip-install-yqjXkS/mysql-python/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/4r/29z_gj1n4szg9r01y5s6rxnm0000gn/T/pip-record-rW5Hej/install-record.txt --single-version-externally-managed --compile --install-headers /Users/wang/.virtualenvs/flask-demo/include/site/python2.7/mysql-python Check the logs for full command output.
大致来看,是cc命令执行失败,没太多的思路,遂谷歌;
尝试
stackoverflow答案
参考上面的链接,执行了一下,甚至也执行了一次评论里的内容,但实际上并没啥用……
后面甚至出现了新的问题……
csdn答案
https://blog.csdn.net/love_parents/article/details/80938818
尝试了后,又提示其他的问题
ERROR: Command errored out with exit status 1:
command: /Users/wang/.virtualenvs/flask-demo/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/4r/29z_gj1n4szg9r01y5s6rxnm0000gn/T/pip-install-xonLuB/mysql-python/setup.py'"'"'; __file__='"'"'/private/var/folders/4r/29z_gj1n4szg9r01y5s6rxnm0000gn/T/pip-install-xonLuB/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/4r/29z_gj1n4szg9r01y5s6rxnm0000gn/T/pip-install-xonLuB/mysql-python/pip-egg-info
cwd: /private/var/folders/4r/29z_gj1n4szg9r01y5s6rxnm0000gn/T/pip-install-xonLuB/mysql-python/
Complete output (9 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/4r/29z_gj1n4szg9r01y5s6rxnm0000gn/T/pip-install-xonLuB/mysql-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 53, in get_config
libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
File "setup_posix.py", line 8, in dequote
if s[0] in "\"'" and s[0] == s[-1]:
IndexError: string index out of range
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
这个问题,在此篇文章有提到,但按照他的方法并不能解决,遂继续谷歌
最终解决办法
https://www.cnblogs.com/LordNeo/p/9687832.html
参考这篇文章执行了重新安装了 mysql-connector-c ,修改了mysql的配置文件;
执行了brew info openssl,得到
(flask-demo) ➜ homebrew-core git:(master) brew info openssl
openssl: stable 1.0.2t (bottled) [keg-only]
SSL/TLS cryptography library
https://openssl.org/
/usr/local/Cellar/openssl/1.0.2t (1,795 files, 12.0MB)
Poured from bottle on 2019-10-30 at 18:26:15
From: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git/Formula/openssl.rb
==> 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/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
openssl is keg-only, which means it was not symlinked into /usr/local,
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/opt/openssl/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
For pkg-config to find openssl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"
随后执行了提示里的 echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc
同时,把下面语句加入了 bash_profile 并source bash_profile。
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
再使用 pip安装,成功了……
后记
都2019年了,Mac/Linux安装这个包还要这么心累………………
Mac安装MySQL-python的血泪史的更多相关文章
- mac安装mysql及终端操作mysql与pycharm的数据库可视化
一.Mac安装mysql 首先下载mysql,地址:https://dev.mysql.com/downloads/mysql/ 然后已知安装就好了,会出现让你记住密码的提示,然后就安装好了.... ...
- mac安装mysql数据库及配置环境变量
mac安装mysql数据库及配置环境变量 mac安装mysql数据库及配置环境变量 原文文链接:https://blog.csdn.net/qq_36004521/article/details/80 ...
- mac 安装mysql + 修改root用户密码 + 及报Access denied for user 'root'@'localhost' (using password:YES)解决办法
1.下载MySQL 到mysql的官网http://dev.mysql.com/downloads/mysql/然后在页面中会看到“MySQL Community Server”下方有一个“downl ...
- Mac 安装 MySQL
在 Mac 下用 Homebrew 安装 MySQL, 网上的教程倒是很多,不过大多数都很默契地雷同.如果稍有点定制要求,就无从下手了. 我先也不免俗,从基本的开始: 一.首先安装 Homebrew ...
- Install MySQL on Mac OS X——MAC安装MySQL
很多关于如何安装MySQL的教程已经过时了,或者比必须的步骤复杂得多.这篇教程将展示如何安装MySQL,启动MySQL,以root用户进入MySQL,以及创建删除退出数据库. Step 1: 下载My ...
- Mac安装Mysql无法登录
Mac安装的Mysql5.7.10 执行mysql -u root -p 就要求输入密码,但是新安装是没密码的.然后就会报错. ERROR 1045 (28000): Access denied fo ...
- mac 安装mysql 修改密码
我草!!! 上网查资料,安装mysql,一大推废话,简直就是他妈的瞎扯淡,真是能他妈的瞎编,草! 为了不让后面的同学看到那些狗屁不通的资料,我把自己安装mysql的步骤,以及修改mysql密码的方法梳 ...
- mac安装mysql的两种方法(含配置)
1.使用安装包安装mysql 双击打开安装文件 双击pkg文件安装 一路向下,记得保存最后弹出框中的密码(它是你mysql root账号的密码) 正常情况下,安装成功. 此时只是安装成功,但还需要额外 ...
- mac安装mysql及workbench
安装mysql 登录MySQL网站 打开网站Download MySQL Community Server,选择下方的dmg文件下载 点击download,此处为8.0.11版本 然后选择no tha ...
- mac 安装 mysql 配置
前言:下面主要介绍2种安装方法以及后续的配置,希望对大家有帮助.(推荐通过安装包的形式安装) 1. 使用安装包安装 mysql 双击打开安装文件 双击pkg文件安装 一 ...
随机推荐
- prometheus学习系列六: Prometheus relabel配置
relabel_config 重新标记是一个功能强大的工具,可以在目标的标签集被抓取之前重写它,每个采集配置可以配置多个重写标签设置,并按照配置的顺序来应用于每个目标的标签集. 目标重新标签之后,以_ ...
- Java的常见术语(PO/POJO/VO/BO/DAO/DTO)
PO(persistant object) 持久对象在o/r 映射的时候出现的概念,如果没有o/r映射,就没有这个概念存在了.通常对应数据模型(数据库),本身还有部分业务逻辑的处理.可以看成是与数据库 ...
- linux设备驱动程序-设备树(3)-设备树多级子节点的转换
linux设备驱动程序--设备树多级子节点的转换 在上一章:设备树处理之--device_node转换成platform_device中,有提到在设备树的device_node到platform_de ...
- 尾递归 递归函数中,递归调用是整个函数体中最后的语句,且它的返回值不属于表达式的一部分时,这个递归调用就是尾递归,空间复杂度是O(1)
什么是递归深度 递归深度就是递归函数在内存中,同时存在的最大次数. 例如下面这段求阶乘的代码: Java: int factorial(int n) { if (n == 1) { return 1; ...
- 爬虫-requests用法
中文文档 API: http://requests.kennethreitz.org/zh_CN/latest/ 安装 pip install requests 获取网页 # coding=utf-8 ...
- 解决在IDEA中无法使用Scanner输入的问题
今天写了一段代码用来测试输入,发现不管怎么样搜无法输入数据,代码如下: @Testpublic void func01(){ Scanner scanner = new Scanner(System. ...
- MongoDB权限配置
参考文章:https://blog.csdn.net/qq_26896281/article/details/81206492 https://blog.csdn.net/u012373281/art ...
- 《OKR工作法》| 一次说太多等于什么都没说
在<OKR工作法>中,作者用汉娜和杰克一起创造TeaBee的故事来为我们讲解OKR可以解决的问题以及如何去实践OKR.给我印象最深的他们用OKR目标管理失败的时候埋怨这种管理方法是有问题的 ...
- Python爬虫 | xpath的安装
错误信息:程序包无效.详细信息:“Cannot load extension with file or directory name . Filenames starting with "& ...
- 使用docker部署微服务
https://my.oschina.net/silenceyawen/blog/1819472 http://jvm123.com/2019/08/docker-shi-yong.html 从201 ...