使用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的更多相关文章

  1. IndexError:string index out of range

    IndexError:string index out of range 出现在下标越界的情况,如 item[1],可能为空的时候下标就会越界

  2. 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 ...

  3. MacOS 安装MysqlDB 问题解决方案( 解决 IndexError: string index out of range)

    pip install MySQL-python时报错如下: Command "python setup.py egg_info" failed with error code 1 ...

  4. pyinstaller 将.py生成.exe ----报错 “IndexError: tuple index out of range”

    pyinstaller将py打包为exe文件,用pysintaller居然报错 File "c:\anaconda3\lib\site-packages\PyInstaller\depend ...

  5. java.lang.StringIndexOutOfBoundsException: String index out of range: 0

    hibernet 报错 java.lang.StringIndexOutOfBoundsException: String index out of range: 0 处理方法  数据表字段为char ...

  6. Python常见错误:IndexError: list index out of range

    用python写脚本查询字典时,在遍历字典时循环到某一项时老是报错   出现这种错误有两种情况: 第1种可能情况 list[index]index超出范围 第2种可能情况 list是空值就会出现 In ...

  7. python报错IndexError: list index out of range

    今天写个ping vpn的python脚本,报错IndexError: list index out of range 最后查看是python读取文件中出现空格 去掉空格即可

  8. 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 ...

  9. hibernate createSQLQuery StringIndexOutOfBoundsException: String index out of range: 0

    有一个sql用union拼接的如下: select id,(**还有很多字段**),'' as NewName from tb1 union select id,(**还有很多字段**),name a ...

随机推荐

  1. ansible中的docker_container模块

    docker_container模块 1.docker_container模块主要是用于ansible-playbook操作docker容器的一个模块,使用该模块可以实现批量创建docker容器 An ...

  2. zsh of kali

    首先安装zsh: # apt-get update # apt-get install zsh -y 然后直接使用仓库脚本: # sh -c "$(wget https://raw.gith ...

  3. Synchronized偏向锁和轻量级锁的升级

    原文:https://blog.csdn.net/tongdanping/article/details/79647337 锁的优化1.锁升级锁的4中状态:无锁状态.偏向锁状态.轻量级锁状态.重量级锁 ...

  4. 如何为SUSE配置IP地址,网关和DNS

    方法一.在命令行中配置.输入: ifconfig eht0 9.111.66.96 netmask 255.255.255.0 up route add default gw 9.111.66.1 方 ...

  5. vue 修改对象或数组的属性

  6. 关于微信小程序在ios中无法调起摄像头问题

    这几天关于微信小程序开发关于wx.chooseVideo组件问题,因为自己一直是安卓手机上测试,可以调取摄像头,但是应用在ios上无法打开摄像头,困扰了好多天,经过反复查看官方文档,今天总算修复了这个 ...

  7. python写入excel(方式二待完善)

    import xlsxwriter #创建一个工作簿并添加一张工作表,当然工作表是可以命名的# workbook = xlsxwriter.Workbook('Expenses01.xlsx')# w ...

  8. C++内存分配/分布——堆栈存储区

    FROM: C++内存分配方式详解——堆.栈.自由存储区.全局/静态存储区和常量存储区 栈,就是那些由编译器在需要的时候分配,在不需要的时候自动清除的变量的存储区.里面的变量通常是局部变量.函数参数等 ...

  9. Oracle EXPDP导出数据

    Oracle expdp导出表数据(带条件): expdp student/123456@orcl dumpfile=student_1.dmp logfile=student_1.log table ...

  10. 看图轻松理解数据结构与算法系列(NoSQL存储-LSM树) - 全文

    <看图轻松理解数据结构和算法>,主要使用图片来描述常见的数据结构和算法,轻松阅读并理解掌握.本系列包括各种堆.各种队列.各种列表.各种树.各种图.各种排序等等几十篇的样子. 关于LSM树 ...