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 ...
随机推荐
- Docker05-容器
目录 容器介绍 创建容器 案例:创建 redis 的容器 查看容器列表 启动容器 案例:启动redis容器 案例:通过redis客户端进行测试 创建并运行容器 案例:创建并运行一个redis容器 停止 ...
- django的缓存实例应用
那么多的可配置方法,我们用那个呢. 首先在setting中配置你想要的缓存,我这里就用文件的方式是配置.如图: 第二步: 第三步: 第四步: 实现结果: 总结: 都是指明当前资源的有效期,控制浏览器 ...
- 在markdown中插入github仓库中的图片
右击github中的图片,获得链接: https://github.com/nxf75/ML_Library/blob/master/Hadoop/Haddop%E6%A1%86%E6%9E%B6.p ...
- Mybatis容易遇到的问题
1.MyBatis中#和$的区别? 1.使用#的原理是?占位符,而$的原理为直接字符串拼接方式 2.$方式一般使用在写数据库中的固定字段时候才会使用例如表名或者列名(select * from use ...
- ARTS-week7
Algorithm 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标. Two Sum 编写一个 SQL 查询,满足条件:无论 ...
- ARTS-week3
Algorithm 给定一个排序数组,你需要在原地删除重复出现的元素,使得每个元素只出现一次,返回移除后数组的新长度.不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件 ...
- 35 Top Open Source Companies
https://www.datamation.com/open-source/35-top-open-source-companies-1.html If you think of open sour ...
- 优化mybatis框架中的查询用户记录数的案例
通过对mybatis框架的中核心接口和类的分析,发现之前写的那个小demo是有问题的.现在对其进行部分优化. 如果存在多个功能的时候,势必会有很多重复的代码,如,创建sqlsession对象,关闭sq ...
- WinDbg常用命令系列---日志操作相关命令log*
.logopen (Open Log File) .logopen命令将事件和命令的副本从调试器命令窗口发送到新的日志文件. .logopen [Options] [FileName] .logope ...
- Codevs 1358 棋盘游戏(状压DP)
1358 棋盘游戏 时间限制: 1 s 空间限制: 64000 KB 题目等级 : 大师 Master 题目描述 Description 这个游戏在一个有10*10个格子的棋盘上进行,初始时棋子位于左 ...