使用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. 计算机网络基础之IP地址详解

    计算机网络基础之IP地址详解 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.IP地址概述 1>.什么是IP地址 我们为什么要使用逻辑地址(IP地址)来标识网络设备,而不采 ...

  2. 数据库索引数据结构总结——ART树就是前缀树

    数据库索引数据结构总结 from:https://zhewuzhou.github.io/2018/10/18/Database-Indexes/ 摘要 数据库索引是数据库中最重要的组成部分,而索引的 ...

  3. js 预解析以及变量的提升

    js在执行之前会进行预解析. 什么叫预解析? 预:提前 解析:编译 预解析通俗的说:js在执行代码之前会读取js代码,会将变量声明提前. 变量声明包含什么?1.var 声明 2.函数的显示声明. 提前 ...

  4. 【原创】python+selenium,用xlrd,读取excel数据,执行测试用例

    # -*- coding: utf-8 -*- import unittest import time from selenium import webdriver import xlrd,xlwt ...

  5. HRBUST 2040 二叉树的遍历

    给出一棵二叉树的中序和前序遍历,输出它的后序遍历. Input 本题有多组数据,输入处理到文件结束. 每组数据的第一行包括一个整数n,表示这棵二叉树一共有n个节点. 接下来的一行每行包括n个整数,表示 ...

  6. C# 验证控件组

    C# 验证控件允许使用ValidationGroup给验证控件分组,分组后的两组验证控件可以独立使用,互不相干.比如一个页面有登录和注册两个部分,假如使用验证控件组,提交的时候会对所有的验证控件进行验 ...

  7. 树莓派上 Docker 的安装和使用

    Docker 是一个开源的应用容器引擎,可以让开发者打包他们的应用以及依赖包到一个轻量级.可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化.容器是完全使用沙箱机制,相互之间不 ...

  8. 项目Alpha冲刺(10/10)

    1.项目燃尽图 2.今日进度描述 项目进展 完成测试 问题困难 测试用例的设计 心得体会 目标快要完成,队员士气较高 3.会议照片 4.各成员情况 221600106 今日进展 根据测试结果修改代码 ...

  9. hiveSQL常用日期函数

    注意 MM,DD,MO,TU 等要大写 Hive 可以在 where 条件中使用 case when 已知日期 要求日期 语句 结果 本周任意一天 本周一 select date_sub(next_d ...

  10. TED演讲:真正拉开你与周围人之间差距的,是自学能力https://www.bilibili.com/video/av65904878/?spm_id_from=333.788.videocard.1

    conference.summitcouplecapital.topvillageperfecthonestpreciselyEurope.scholarshipforcefalsefoxrealit ...