简体   繁体   中英

Facing below error "ModuleNotFoundError: No module named 'pymysql'"

Facing below error "ModuleNotFoundError: No module named 'pymysql'"

import os
import pymysql
import pandas as pd

host = os.getenv('MYSQL_HOST')
port = os.getenv('MYSQL_PORT')
user = os.getenv('MYSQL_USER')
password = os.getenv('MYSQL_PASSWORD')
database = os.getenv('MYSQL_DATABASE')

Need assistance as I am new to this.

在此处输入图片说明

在此处输入图片说明

This issue got fixed. I installed pymysql and mysql-connector using anaconda prompt.

  1. Open Anaconda Prompt
  2. pip install mysql-connector
  3. pip install pymysql

make sure it's installed.

run this in terminal/cmd:

windows

$ python3 -m pip install PyMySQL

or simply:

pip install PyMySQL

linux

$ sudo apt-get install python3-pymysql

I fixed this on my pc too it took me 1 day :) So go to your cmd or terminal and write : pip uninstall pymysql

python -m pip --upgrade pip pip install pymysql

This will fix it as the version of pip u are using cant build a wheel for the module

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM