How To Install Python PyMySQL Client Library In Ubuntu Linux

preview_player
Показать описание
Python Import Error : No Module Name pymysql

In order to install pymysql which is pure python mysql client library. it Implements the python database db api v2.0 and it is an interface for connecting to Mysql DB database.

In order to install pymysql, first install python3 by
sudo apt-get install python3

then install pip3 by
sudo apt-get install python3-pip

and then install pymysql by
pip3 install pymysql

to check , open python interpreter mode, by
python3

and then run
import pymysql

if it successfully runs and does not throw any error.
You have successfully installed pymysql python3 library in ubuntu linux.
Рекомендации по теме
Комментарии
Автор

Hello, I have a problem. I have successfully installed pymysql from a terminal window onto my mac osx (current version: Mojave), and when I enter python3 window and do what you did to test to see if any errors would be thrown, none werre and it was good until I tried it in a python3 .py file. I get a connection refused error when I us the following:


import pymysql # no problem here


db = pymysql.connect("localhost", "username", "pswd", "databasename") #HERE IS GET THE CONNECTION REFUSED


Any help resolving this is greatly appreciated. Thansks and I await your reply




TIm

FRIENDSofCAP