ModuleNotFoundError:没有名为“ mysql.connector”的模块; 'mysql'不是软件包

我尝试了这个:

pip install mysql-connector-python

它说满足要求。

然后我用了:

pip install mysql-connector-python-rf

并得到此错误:

ERROR: Command errored out with exit status 1:
     command: 'c:\users\arush\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\arush\\AppData\\Local\\Temp\\pip-install-komi1sg9\\mysql-connector-python-rf\\setup.py'"'"'; __file__='"'"'C:\\Users\\arush\\AppData\\Local\\Temp\\pip-install-komi1sg9\\mysql-connector-python-rf\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, 
__file__, '"'"'exec'"'"'))' install --record 'C:\Users\arush\AppData\Local\Temp\pip-record-ov8jdz89\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\arush\appdata\local\programs\python\python37\Include\mysql-connector-python-rf'
         cwd: C:\Users\arush\AppData\Local\Temp\pip-install-komi1sg9\mysql-connector-python-rf\    
    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
appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\arush\\AppData\\Local\\Temp\\pip-install-komi1sg9\\mysql-connector-nizedpython-rf\\setup.py'"'"'; __file__='"'"'C:\\Users\\arush\\AppData\\Local\\Temp\\pip-install-komi1sg9\\mysql-connector-python-rappdata\local\programs\python\pythonf\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__fiv[0] = '"'"'C:\\Users\\arush\\AppDatle__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.clo\\setup.py'"'"'; __file__='"'"'C:\\Use();exec(compile(code, __file__, '"'"'exec'"'"'))' install --rconnector-python-rf\\setup.py'"'"';fecord 'C:\Users\arush\AppData\Local\Temp\pip-record-ov8jdz89\in).replace('"'"'\r\n'"'"', '"'"'\n'"'stall-record.txt' --single-version-externally-managed --compilestall --record 'C:\Users\arush\AppDa --install-headers 'c:\users\arush\appdata\local\programs\pythoversion-externally-managed --compilen\python37\Include\mysql-connector-python-rf' Check the logs fon\python37\Include\mysql-connector-pr full command output.
评论
  • 俄还好
    俄还好 回复

    You may be using python three instead. Try pip3 instead of pip when installing via the terminal

  • HORSE
    HORSE 回复

    如果不获取一些其他背景信息,很难回答这个问题。例如,您是Windows吗?您的点子更新了吗?您是否从anaconda安装了Python?您是否安装了多个版本的Python?

    我本以为“已经满足要求”意味着您将文件安装在某处。