鱼C论坛

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

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

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

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

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

x
这个怎么解决才能成功安装库

  1. **************deapple$ pip install mysql
  2. 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/
  3. Collecting mysql
  4.   Using cached mysql-0.0.2.tar.gz (1.9 kB)
  5. Collecting mysqlclient
  6.   Using cached mysqlclient-2.0.1.tar.gz (87 kB)
  7.     ERROR: Command errored out with exit status 1:
  8.      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
  9.          cwd: /private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-1d7098sg/mysqlclient/
  10.     Complete output (12 lines):
  11.     /bin/sh: mysql_config: command not found
  12.     /bin/sh: mariadb_config: command not found
  13.     /bin/sh: mysql_config: command not found
  14.     Traceback (most recent call last):
  15.       File "<string>", line 1, in <module>
  16.       File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-1d7098sg/mysqlclient/setup.py", line 15, in <module>
  17.         metadata, options = get_config()
  18.       File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-1d7098sg/mysqlclient/setup_posix.py", line 65, in get_config
  19.         libs = mysql_config("libs")
  20.       File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-1d7098sg/mysqlclient/setup_posix.py", line 31, in mysql_config
  21.         raise OSError("{} not found".format(_mysql_config_path))
  22.     OSError: mysql_config not found
  23.     ----------------------------------------
  24. 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

试试这样把:

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

使用道具 举报

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

试试这样把:

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

使用道具 举报

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

这样了

  1. ERROR: Command errored out with exit status 1:
  2.      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
  3.          cwd: /private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-xcs5_ky6/mysqlclient/
  4.     Complete output (12 lines):
  5.     /bin/sh: mysql_config: command not found
  6.     /bin/sh: mariadb_config: command not found
  7.     /bin/sh: mysql_config: command not found
  8.     Traceback (most recent call last):
  9.       File "<string>", line 1, in <module>
  10.       File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-xcs5_ky6/mysqlclient/setup.py", line 15, in <module>
  11.         metadata, options = get_config()
  12.       File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-xcs5_ky6/mysqlclient/setup_posix.py", line 65, in get_config
  13.         libs = mysql_config("libs")
  14.       File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-xcs5_ky6/mysqlclient/setup_posix.py", line 31, in mysql_config
  15.         raise OSError("{} not found".format(_mysql_config_path))
  16.     OSError: mysql_config not found
  17.     ----------------------------------------
  18. 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:

  1. python -m pip install --upgrade setuptools
复制代码

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

使用道具 举报

 楼主| 发表于 2020-8-1 14:24:01 | 显示全部楼层
Twilight6 发表于 2020-8-1 14:18
试试升级下 pip:
  1. xiaojiayudeMacBook-Pro:~ xiaojiayudeapple$ python -m pip install mysql -i https://pypi.tuna.tsinghua.edu.cn/simple
  2. 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
  3. Defaulting to user installation because normal site-packages is not writeable
  4. Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
  5. Collecting mysql
  6.   Using cached https://pypi.tuna.tsinghua.edu.cn/packages/bf/5f/b574ac9f70811df0540e403309f349a8b9fa1a25d3653824c32e52cc1f28/mysql-0.0.2.tar.gz (1.9 kB)
  7. Collecting MySQL-python
  8.   Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108 kB)
  9.     ERROR: Command errored out with exit status 1:
  10.      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
  11.          cwd: /private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-ZjhkYM/MySQL-python/
  12.     Complete output (10 lines):
  13.     sh: mysql_config: command not found
  14.     Traceback (most recent call last):
  15.       File "<string>", line 1, in <module>
  16.       File "/private/var/folders/3r/0cbh6s212zb98slf61q37bs80000gn/T/pip-install-ZjhkYM/MySQL-python/setup.py", line 17, in <module>
  17.         metadata, options = get_config()
  18.       File "setup_posix.py", line 43, in get_config
  19.         libs = mysql_config("libs_r")
  20.       File "setup_posix.py", line 25, in mysql_config
  21.         raise EnvironmentError("%s not found" % (mysql_config.path,))
  22.     EnvironmentError: mysql_config not found
  23.     ----------------------------------------
  24. 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
对,我也不知道怎么搞


试试这样:
  1. sudo pip install MySQL-python
复制代码


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-25 20:40

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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