使用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. 肖哥HCNP-学前准备篇笔记

    HCNA:助理 HCNP:工程师 HCIE:专家 vmvare workstation 1.安装 2.创建新的虚拟机-->典型-->稍后安装系统-->选择系统模式-->选择位置 ...

  2. Python入门篇-functools

    Python入门篇-functools 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.reduce方法 reduce方法,顾名思义就是减少 reduce(function,se ...

  3. 使用SecureCRT操作linux系统时候的简单设置

    因为第一次访问一台虚拟机的时候会出现这样的情况;   底色为白色和乱码的情况 需要在选项----->会话选项中进行一些设置 用来解决乱码问题的这个设置为:

  4. Pycharm 主题背景色的配置

    PyCharm是一种Python IDE,带有一整套可以帮助用户在使用Python语言开发时提高其效率的工具.那么它的主题背景如何设置呢? 具体操作:   步骤一:选择 “file” 菜单下的 “se ...

  5. The Open Source Business Model is Under Siege

    https://www.influxdata.com/blog/the-open-source-database-business-model-is-under-siege/ A few weeks ...

  6. Tips on Java

    1.JAVA种数组的两种定义方式. int[] nums; int nums[]. 2.整型默认为int,如果需要long,须加l或L.小数默认double,d或D可省略,但如果需要float,须加f ...

  7. Python 04 Geany的安装和配置

    安装原文:https://www.cnblogs.com/wongyi/p/7832567.html 配置原文:https://jingyan.baidu.com/album/154b46311ed9 ...

  8. 点击复制文字到剪贴板兼容性安卓ios

    一般那种活动H5分享可能会用到点击复制文字到剪贴板,很简单的功能 于是搜了一搜:js复制文字到剪贴板,可用结果大致分为两类: 一类是js原生方法,这种方法兼容性不好,不兼容ios: https://d ...

  9. 【洛谷P5596】【XR-4】题

    solution \(y^2-x^2=ax+b\) \(y^2=x^2+ax+b\) 当\(x^2+ax+b\)为完全平方式时\(Ans=inf\) \(x \leq y\) 不妨令 \(y=x+t\ ...

  10. nbbnbnbnbnb

    1.本章学习总结(2分) 1.1 学习内容总结 结构体的定义与赋值 结构类型定义的一般形式为: struct 结构名 { 类型名 结构成员1: 类型名 结构成员2: ... 类型名 结构成员3: }; ...