Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install MySQLdb package? (ImportError: No module named setuptools)

I am trying to install MySQLdb package. I found the source code here.

I did the following:

gunzip MySQL-python-1.2.3c1.tar.gz tar xvf MySQL-python-1.2.3c1.tar cd MySQL-python-1.2.3c1 python setup.py build 

As the result I got the following:

Traceback (most recent call last):   File "setup.py", line 5, in ?     from setuptools import setup, Extension ImportError: No module named setuptools 

Does anybody knows how to solve this problem? By the way, if I am able to do the described step, I will need to do the following:

sudo python setup.py install 

And I have no system-administrator-rights. Do I still have a chance to install MySQLdb?

Thank you.

like image 517
Verrtex Avatar asked Sep 19 '09 18:09

Verrtex


People also ask

How do I import Setuptools in Python?

Follow the below steps to install the Setuptools package on Linux using the setup.py file: Step 1: Download the latest source package of Setuptools for Python3 from the website. Step 3: Go to the setuptools-60.5. 0 folder and enter the following command to install the package.

How do I fix ModuleNotFoundError No module named Setuptools?

Conclusion # The Python "ModuleNotFoundError: No module named 'setuptools'" occurs when setuptools is not installed in our Python environment. To solve the error, install the module by running the python3 -m pip install --upgrade setuptools .


1 Answers

After trying many suggestions, simply using sudo apt-get install python-mysqldb worked for me.

More info: Getting "Error loading MySQLdb module: No module named MySQLdb" - have tried previously posted solutions

like image 68
davidcstevens Avatar answered Sep 19 '22 05:09

davidcstevens