鱼C论坛

 找回密码
 立即注册
查看: 2036|回复: 10

[已解决]安装mysql库时失败

[复制链接]
发表于 2020-8-1 12:47:27 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
这个怎么解决才能成功安装库
**************deapple$ pip install mysql
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/mysql/
Collecting mysql
  Using cached mysql-0.0.2.tar.gz (1.9 kB)
Collecting mysqlclient
  Using cached mysqlclient-2.0.1.tar.gz (87 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-1d7098sg/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-1d7098sg/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-pip-egg-info-jzjbmo18
         cwd: /private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-1d7098sg/mysqlclient/
    Complete output (12 lines):
    /bin/sh: mysql_config: command not found
    /bin/sh: mariadb_config: command not found
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-1d7098sg/mysqlclient/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-1d7098sg/mysqlclient/setup_posix.py", line 65, in get_config
        libs = mysql_config("libs")
      File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-1d7098sg/mysqlclient/setup_posix.py", line 31, in mysql_config
        raise OSError("{} not found".format(_mysql_config_path))
    OSError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
最佳答案
2020-8-1 13:23:18

试试这样把:
python -m pip install mysql -i https://pypi.tuna.tsinghua.edu.cn/simple
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-8-1 13:23:18 | 显示全部楼层    本楼为最佳答案   

试试这样把:
python -m pip install mysql -i https://pypi.tuna.tsinghua.edu.cn/simple
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-8-1 14:14:40 | 显示全部楼层

这样了
ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-xcs5_ky6/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-xcs5_ky6/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-pip-egg-info-8ma3xtnw
         cwd: /private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-xcs5_ky6/mysqlclient/
    Complete output (12 lines):
    /bin/sh: mysql_config: command not found
    /bin/sh: mariadb_config: command not found
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-xcs5_ky6/mysqlclient/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-xcs5_ky6/mysqlclient/setup_posix.py", line 65, in get_config
        libs = mysql_config("libs")
      File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-xcs5_ky6/mysqlclient/setup_posix.py", line 31, in mysql_config
        raise OSError("{} not found".format(_mysql_config_path))
    OSError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-8-1 14:15:34 | 显示全部楼层

你用 PyCharm 还是什么?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-8-1 14:16:20 | 显示全部楼层
Twilight6 发表于 2020-8-1 14:15
你用 PyCharm 还是什么?

VSC
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-8-1 14:17:05 | 显示全部楼层
Twilight6 发表于 2020-8-1 14:15
你用 PyCharm 还是什么?

Mac终端上 输入的命令
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-8-1 14:18:47 | 显示全部楼层
ten$1 发表于 2020-8-1 14:17
Mac终端上 输入的命令

试试升级下 pip:
python -m pip install --upgrade setuptools
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-8-1 14:24:01 | 显示全部楼层
Twilight6 发表于 2020-8-1 14:18
试试升级下 pip:
xiaojiayudeMacBook-Pro:~ xiaojiayudeapple$ python -m pip install mysql -i https://pypi.tuna.tsinghua.edu.cn/simple
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting mysql
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/bf/5f/b574ac9f70811df0540e403309f349a8b9fa1a25d3653824c32e52cc1f28/mysql-0.0.2.tar.gz (1.9 kB)
Collecting MySQL-python
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108 kB)
    ERROR: Command errored out with exit status 1:
     command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-ZjhkYM/MySQL-python/setup.py'"'"'; __file__='"'"'/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-ZjhkYM/MySQL-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-pip-egg-info-wj3wH0
         cwd: /private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-ZjhkYM/MySQL-python/
    Complete output (10 lines):
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-ZjhkYM/MySQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-8-1 14:31:32 | 显示全部楼层

电脑有多版本的Python, 2.7 和 3.8 吗?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2020-8-1 14:34:52 | 显示全部楼层
Twilight6 发表于 2020-8-1 14:31
电脑有多版本的Python, 2.7 和 3.8 吗?

对,我也不知道怎么搞
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2020-8-1 12:47:28 | 显示全部楼层
本帖最后由 Twilight6 于 2020-8-1 14:42 编辑
ten$1 发表于 2020-8-1 14:34
对,我也不知道怎么搞


试试这样:
sudo pip install MySQL-python

看看这个文章能不能解决:https://blog.csdn.net/du_wood/article/details/84922312


想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-1-19 17:02

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表