mac安装MySQLdb:IndexError: string index out of range
使用mac安装MySQLdb的时候出现string index out of range
大概的错误是这样的:

然后尝试手动安装,我下载了包后,依然出现这个错误。
于是百度了下:
https://www.jianshu.com/p/da9dd5dd4bd2
这个匹配度是最高的,但是这个兄弟居然半路放弃了(没有转载哈)....
后来我就google了下,
原贴地址:https://stackoverflow.com/questions/51123044/pip-install-mysql-python
最后得出结论:
(前提:基于brew安装,如果没有安装,请自行百度安装,就一句话。)
1.首先安装mysql-connector-c
brew install mysql-connector-c
2.然后修改mysql_config 的内容
vim /usr/local/bin/mysql_config
修改内容:
# Create options
libs="-L$pkglibdir"
libs="$libs -l "
替换成:
# Create options
libs="-L$pkglibdir"
libs="$libs -lmysqlclient -lssl -lcrypto"
3.设置环境变量
brew info openssl
it would tell what’s needed
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
For pkg-config to find this software you may need to set:
PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig
4.然后再执行安装
pip install MySQL-python
大功告成

mac安装MySQLdb:IndexError: string index out of range的更多相关文章
- IndexError:string index out of range
IndexError:string index out of range 出现在下标越界的情况,如 item[1],可能为空的时候下标就会越界
- Mac安装Mysql-python遇到的坑,被这俩报错反复摩擦:'my_config.h' file not found 和 IndexError: string index out of range
最后Stackoverflow上面的大神解决了问题: Link brew install mysql brew unlink mysql brew install mysql-connector-c ...
- MacOS 安装MysqlDB 问题解决方案( 解决 IndexError: string index out of range)
pip install MySQL-python时报错如下: Command "python setup.py egg_info" failed with error code 1 ...
- pyinstaller 将.py生成.exe ----报错 “IndexError: tuple index out of range”
pyinstaller将py打包为exe文件,用pysintaller居然报错 File "c:\anaconda3\lib\site-packages\PyInstaller\depend ...
- java.lang.StringIndexOutOfBoundsException: String index out of range: 0
hibernet 报错 java.lang.StringIndexOutOfBoundsException: String index out of range: 0 处理方法 数据表字段为char ...
- Python常见错误:IndexError: list index out of range
用python写脚本查询字典时,在遍历字典时循环到某一项时老是报错 出现这种错误有两种情况: 第1种可能情况 list[index]index超出范围 第2种可能情况 list是空值就会出现 In ...
- python报错IndexError: list index out of range
今天写个ping vpn的python脚本,报错IndexError: list index out of range 最后查看是python读取文件中出现空格 去掉空格即可
- Spring Boot 启动报错 Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37
使用命令 java -jar springBoot.jar 启动项目,结果报错如下: Exception at java.lang.String.substring(String.java:) at ...
- hibernate createSQLQuery StringIndexOutOfBoundsException: String index out of range: 0
有一个sql用union拼接的如下: select id,(**还有很多字段**),'' as NewName from tb1 union select id,(**还有很多字段**),name a ...
随机推荐
- ETL 的一些概念
1. What is a logical data mapping and what does it mean to the ETL team? 什么是逻辑数据映射?它对ETL项目组的作用是什么? 答 ...
- 19.centos7基础学习与积累-005-命令总结01
从头开始积累centos7系统运用 大牛博客:https://blog.51cto.com/yangrong/p5 1.查看命令帮助的方法: --help 适用于一般命令,非内置命令 man 适用于 ...
- Linux-网络RAID技术DRBD
DRBD简介 官方文档 DRBD的全称为:Distributed Replicated Block Device(DRBD)分布式块设备复制,DRBD是由内核模块和相关脚本构成,用以构建高可用的集群. ...
- c++查询特定字符串位置
size_t find (const string& str, size_t pos = 0) const noexcept;(摘自c++官网:std::string::find) size_ ...
- 微服务:springboot与swagger2的集成
现在测试都提倡自动化测试,那我们作为后台的开发人员,也得进步下啊,以前用postman来测试后台接口,那个麻烦啊,一个字母输错就导致测试失败,现在swagger的出现可谓是拯救了这些开发人员,便捷之处 ...
- P1525 关押罪犯[扩展域并查集]
题目来源:洛谷 题目描述 S城现有两座监狱,一共关押着N名罪犯,编号分别为1−N.他们之间的关系自然也极不和谐.很多罪犯之间甚至积怨已久,如果客观条件具备则随时可能爆发冲突.我们用“怨气值”(一个正整 ...
- python开发总结
1.思维缜密的编程逻辑 2.满足明确的目的需求 3.运用现成的轮子加以改造 4.学会装饰自己的程序 5.化繁为简 6.多用配置文件作为入口 7.注意扩展兼容
- Thinkphp下实现D函数用于实例化Model格式
* D函数用于实例化Model 格式 项目://分组/模块 * @param string $name Model资源地址 * @param string $layer 业务层名称 * @return ...
- MySQL——查询优化|47s到0.1s|我做了什么
前言 这个代码是之前的同事写的,现在我接管了,但是今天早上我打开这个模块的时候发现数据加载异常的缓慢,等了将近一分钟左右数据才显示到页面. 这特么的绝对不正常啊,数据量压根没那么多呀,这特喵的什么情况 ...
- oracle连接出现的坑
一.错误代码提示 请输入用户名: SYS 输入口令: ERROR: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER 二.解决方 ...