ubuntu安装mysql连接依赖报错问题处理

首先报错如下

from mysql import connector ImportError: No module named 'mysql'

然后尝试安装依赖

执行命令

python -m pip install mysql-connector-python-rf -i https://pypi.douban.com/simple/

报如下错

$ python -m pip install mysql-connector-python-rf
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Collecting mysql-connector-python-rf
  Downloading mysql-connector-python-rf-2.2.2.tar.gz (11.9 MB)
     |▊                               | 286 kB 36 kB/s eta 0:05:24^C
ERROR: Operation cancelled by user
(py35) EUROPRO\yanyan.zhao@bej-lt-pf28l83e:~/scode/kitchen_survey$ python -m pip install mysql-connector-python-rf -i https://pypi.douban.com/simple/
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Looking in indexes: https://pypi.douban.com/simple/
Collecting mysql-connector-python-rf
  Using cached https://mirrors.cloud.tencent.com/pypi/packages/21/79/2ff01ab7aa08db3a16b70b990c579c1024c6b2a734263cc7513a758867de/mysql-connector-python-rf-2.2.2.tar.gz (11.9 MB)
Using legacy 'setup.py install' for mysql-connector-python-rf, since package 'wheel' is not installed.
Installing collected packages: mysql-connector-python-rf
    Running setup.py install for mysql-connector-python-rf ... error
    ERROR: Command errored out with exit status 1:
     command: /home/local/EUROPRO/yanyan.zhao/.myvirtualenv/py35/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h75jxbig/mysql-connector-python-rf_2c9be97a3b634fc4a69488f4c8ac56c4/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h75jxbig/mysql-connector-python-rf_2c9be97a3b634fc4a69488f4c8ac56c4/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-d8bsro4j/install-record.txt --single-version-externally-managed --compile --install-headers /home/local/EUROPRO/yanyan.zhao/.myvirtualenv/py35/include/site/python3.5/mysql-connector-python-rf
         cwd: /tmp/pip-install-h75jxbig/mysql-connector-python-rf_2c9be97a3b634fc4a69488f4c8ac56c4/
    Complete output (6 lines):
    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: setup.py --help [cmd1 cmd2 ...]
       or: setup.py --help-commands
       or: setup.py cmd --help
    
    error: option --single-version-externally-managed not recognized
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/local/EUROPRO/yanyan.zhao/.myvirtualenv/py35/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h75jxbig/mysql-connector-python-rf_2c9be97a3b634fc4a69488f4c8ac56c4/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h75jxbig/mysql-connector-python-rf_2c9be97a3b634fc4a69488f4c8ac56c4/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-d8bsro4j/install-record.txt --single-version-externally-managed --compile --install-headers /home/local/EUROPRO/yanyan.zhao/.myvirtualenv/py35/include/site/python3.5/mysql-connector-python-rf Check the logs for full command output.

解决方式:先安装wheel

python -m pip install wheel -i https://pypi.douban.com/simple/

python -m pip install mysql-connector-python-rf -i https://pypi.douban.com/simple/

到此就安装成功了

  • 6
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值