【问题标题】:pip command issue - Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-7n_jim1n/mysql-python/pip 命令问题 - 命令“python setup.py egg_info”失败,错误代码 1 在 /private/tmp/pip-build-7n_jim1n/mysql-python/
【发布时间】:2018-11-03 17:44:00
【问题描述】:

我正在使用 MACos 终端,无法在 python 上安装 mysql。

pip3 install mysql-python

目录 '/Users/aligrdas/Library/Caches/pip/http' 或其父目录不归当前用户所有,缓存已被禁用。请检查该目录的权限和所有者。如果使用 sudo 执行 pip,您可能需要 sudo 的 -H 标志。 目录 '/Users/aligrdas/Library/Caches/pip' 或其父目录不归当前用户所有,并且缓存轮已被禁用。检查该目录的权限和所有者。如果使用 sudo 执行 pip,您可能需要 sudo 的 -H 标志。

收集mysql-python下载 https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB) 100% |████████████████████████████████| 112kB 159kB/s 命令 python setup.py egg_info 的完整输出: 回溯(最近一次通话最后): 文件“”,第 1 行,在 文件“/private/tmp/pip-build-7n_jim1n/mysql-python/setup.py”,第 13 行,在 从 setup_posix 导入 get_config 文件“/private/tmp/pip-build-7n_jim1n/mysql-python/setup_posix.py”,第 2 行, 在 从 ConfigParser 导入 SafeConfigParser ModuleNotFoundError: 没有名为“ConfigParser”的模块

----------------------------------------

命令“python setup.py egg_info”失败,错误代码 1 在 /private/tmp/pip-build-7n_jim1n/mysql-python/

【问题讨论】:

    标签: python python-3.x macos python-2.7 terminal


    【解决方案1】:

    根据 PEP 8 标准,ConfigParser 在 Python 3 中已重命名为小写为 configparser,并且您尝试安装的软件包尚未更新或可能不支持它。

    尝试使用以下命令:

    pip install mysqlclient
    

    如果不使用以下命令,请检查您的系统上是否安装了mysql-connector-c:

    brew install mysql-connector-c
    

    问题的有效解决方案:

    1) brew unlink mysql-connector-c 
    2) brew install mysql 
    3) brew link mysql-connector-c 
    4) sudo pip install mysqlclient
    

    【讨论】:

    • raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found -------------------- -------------------- 命令“python setup.py egg_info”在 /private/tmp/pip-install-R1Dazz/mysqlclient/中失败,错误代码为 1 >
    • sh: mysql_config: command not found EnvironmentError: mysql_config not found ------------------------------ ---------- 命令“python setup.py egg_info”在/private/tmp/pip-install-qVwv3A/mysqlclient/中失败,错误代码为1
    • 使用brew install mysql 和export PATH=$PATH:/usr/local/mysql/bin 然后上面的命令
    • 命令 python setup.py egg_info 的完整输出:回溯(最近一次调用最后):文件“”,第 1 行,在 文件“/private/tmp/pip-install -dvgCAv/mysqlclient/setup.py",第 17 行,在 元数据中,options = get_config() 文件“setup_posix.py”,第 54 行,在 get_config 库 = [dequote(i[2:]) for i in libs if i.startswith('-l')] 文件“setup_posix.py”,第 12 行,取消引用 if s[0] in "\"'" and s[0] == s[-1]: IndexError:字符串索引超出范围
    • 尝试在LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient上使用标志
    猜你喜欢
    • 2016-02-14
    • 2017-12-13
    • 2021-10-23
    • 2019-08-24
    • 1970-01-01
    • 1970-01-01
    • 2018-05-18
    • 2023-04-01
    • 2019-08-10
    相关资源
    最近更新 更多