MySQL Python Connector Failure

问题: I have installed Python 3.7 64-bit on my 64-bit OS. I have also Installed mysql-installer-community-8.0.15.0 plus I installed MySQL connector using this code python -m pip...

问题:

I have installed Python 3.7 64-bit on my 64-bit OS. I have also Installed mysql-installer-community-8.0.15.0 plus I installed MySQL connector using this code python -m pip install mysql-connector and still when I try to import mysql.connector. I get this error.

"C:UsersBasir PayendaPycharmProjectsnewprjvenvScriptspython.exe" "C:/Users/Basir Payenda/PycharmProjects/newprj/app.py" Traceback (most recent call last): File "C:/Users/Basir Payenda/PycharmProjects/newprj/app.py", line 1, in import mysql.connector ModuleNotFoundError: No module named 'mysql'

In addition, I installed mysql-connector-python-8.0.15-py3.7-windows-x86-64bit as well on my machine. Please help me solve this problem, I have tried all possible things I could. Thank you

edit: Used the following codes to install mysql.connector

C:UsersBasir PayendaAppDataLocalProgramsPythonPython37Scripts>python -m pip install mysql-connector

and

pip3 install mysql-connector

using pip3 I get this message:

Requirement already satisfied: mysql-connector in C:usersbasir payendaappdatalocalprogramspythonpython37libsite-packages <2.1.6>

and again when I go to pycharm and import mysql.connector I get above stated message no module 'mysql' found

edit after 2 hours: No answers, I tried this. I uninstalled everything, python, mysql, pychar and reinstalled. Again the same problem. SHOULD I CHANGE MY COMPUTER?


回答1:

Try to activate the virtual environment from folder "newprj" before installing the modules: venvScriptsactivate. Next you will see: "(venv) C:UsersBasir PayendaPycharmProjectsnewprj>" Then try installing the packages again.

  • 发表于 2019-03-02 04:14
  • 阅读 ( 340 )
  • 分类:sof

条评论

请先 登录 后评论
不写代码的码农
小编

篇文章

作家榜 »

  1. 小编 文章
返回顶部
部分文章转自于网络,若有侵权请联系我们删除