使用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. PHP 接口输出 图片

    html: <img src="{eq name='v.miniqrcode' value=""}{:url('makeMiniQrcode_do')}?id={$ ...

  2. MySQL基础操作与数据类型

    目录 1.文件夹(库) 2.文件(表) 3.文件的一行内容 4.创建表的完整语法 5.整型类型 6.补充sql_mode 7.浮点型 8.字符类型 9.日期类型 10.枚举与集合类型 1.文件夹(库) ...

  3. supervisor安装部署文档和管理实例

    Supervisord是用Python实现的一款非常实用的进程管理工具,类似于monit(关于monit见我的博客:用monit监控系统关键进程),monit和supervisord的一个比较大的差异 ...

  4. Kotlin反射操纵构造方法与伴生对象

    反射操纵伴生对象: 先定义一个伴生对象: 然后咱们通过反射来调用一下它: 比较简单. 反射操纵构造方法: 先来定义一个类: 然后咱们通过反射来调用一个其中的方法,之前当然就得先来调用构造方法,由于我们 ...

  5. Vue 路由守卫解决页面退出和弹窗的显示冲突

    在使用UI框架提供的弹出层Popup时,如Vant UI的popup,在弹出层显示时,点击物理按键或者小程序自带的返回时,会直接退出页面,这明显不符合页面逻辑. 解决思路: 在弹出层显示时,点击了返回 ...

  6. DNS隧道

    自己使用的dns隧道通过两种方法,一种是通过dnscat2工具,另一种通过cs上的beacon来进行通信. 第一种方法:dnscat2: 参考文章:https://xz.aliyun.com/t/22 ...

  7. 2019牛客国庆集训派对day1 K题 双向链表练习题 splay区间翻转

    题目链接: 解法: 先建n颗平衡树,合并的时候将a中最右的结点翻转到根节点,b中最左的结点翻转到根节点,对合并后的根节点进行标记. #include <bits/stdc++.h> usi ...

  8. java 修改HttpServletRequest的参数或请求头

    场景:过滤器中获取参数Token并添加到请求头(用户认证兼容老系统) 请求头和请求参数是不能直接修改,也没有提供修改的方法,但是可以在过滤器和拦截器中使用HttpServletRequestWrapp ...

  9. go正则表达式

    单行模式(?s:(.?))万能用法尽量匹配少的文本,最关键的是可以匹配换行的文本,直接写.?不能匹配\n package main import ( "fmt" "reg ...

  10. Windbg的命令

    前面介绍了Windbg的UI功能,也基本上能完成基本的调试任务,但是WinDBG主要是以命令方式工作的,这些命令在Command Window里输入.WinDBG共支持三类命令:标准命令.元命令和扩展 ...