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 ...
随机推荐
- Oracle 11g RAC to RAC ADG搭建(一)采用rman备份恢复方式
(一)基础环境 主库 备库 操作系统 RedHat6.7 RedHat6.7 服务器名称 primarydb1primarydb2 standbydb1standbydb2 IP地址规划 192. ...
- Maven nexus 安装nexus : wrapper | OpenSCManager failed - 拒绝访问。 (0x5)
在win7中安装nexus时提示:wrapper | OpenSCManager failed - 拒绝访问. (0x5) 主要是没有权限.需要以管理员的身份运行 如果你是直接点击 start-nex ...
- springboot注解@NotNull,@NotBlank,@Valid自动判定空值
一.前言 搭建springboot项目,我们都是采用的Restful接口,那么问题来了,当前端调用接口或者是其他项目调用时,我们不能单一靠调用方来控制参数的准确性,自己也要对一些非空的值进行判定. 二 ...
- 【Docker】docker安装mysql
一.下载镜像并运行容器 docker run -p 3306:3306 --name mymysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs ...
- 在vps中搭建ftp服务器
1. 服务器配置 首先当然是更新源列表并安装 vsftpd. sudo apt-get update sudo apt-get install vsftpd 安装完成后我们需要对服务器进行进一步的配置 ...
- Hbase架构与原理(转)
Hbase架构与原理 HBase是一个分布式的.面向列的开源数据库,该技术来源于 Fay Chang所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”.就像Bigtable利 ...
- 如何解决IntelliJ idea的maven工程提示的Cannot Resolve Symbol
IDEA无法识别一个类类,将其显示为红色,如果 compile 没有问题.鼠标放上去后显示 “Cannot resolve symbol XXX”,有两种解决方式:(1)点击菜单中的 “File” - ...
- 在本地调用hadoop的api
第一次在本地运行Java代码,调用hadoop的hdfs的api接口,遇到下面的问题: 1.HADOOP_HOME and hadoop.home.dir are unset 解决办法:在本地安装配置 ...
- ASP.NET Core ---- 系列文章
(13)ASP.NET Core 中的选项模式(Options) (12)ASP.NET Core 中的配置二(Configuration) (11)ASP.NET Core 中的配置一(Config ...
- .Net Core控制台生成exe能独立运行
.Net Core控制台生成exe能独立运行,依赖文件都单独生成在一个publish文件夹里 方式一:强烈推荐,能独立运行,依赖DLL也会生成出来,支持无安装环境也能到处运行 按win+R输入cmd在 ...