2

I have installed MySqldb as shown below:-

jab-MacBook-Pro-4:silkroute deb$ pip install MySQL-python
Collecting MySQL-python
Installing collected packages: MySQL-python
Successfully installed MySQL-python-1.2.5

But still I am getting the error:-

enter image description here

python --version
Python 2.7.11

I am using version 2.7.10 in PyCharm

enter image description here

I have also installed MySQLDB as shown below:-

jab-MacBook-Pro-4:silkroute deb$ pip2.7 install MySQL-python
Requirement already satisfied: MySQL-python in /usr/local/lib/python2.7/site-packages

Can someone let me know how can I get rid of this error?

tuk
  • 5,941
  • 14
  • 79
  • 162

3 Answers3

3

Your Pycharm was not using the right python environment.You can change the project interpreter by setting Pycharm. Step:

  • File-> Settings
  • In Popup menu: Project-> Project Interpreter-> add or create virtualenv environment

After changing project interpreter, the Pycharm has many function to use You can use Pycharm to install Package

Jenner
  • 46
  • 6
2

Open PyCharm, File>>Default Settings>>Project Interpreter>>Select the Interpreter you want to install the packages to, press the red '+' sign to the right, search the package and install.

This should most probably correct your error. You are better off creating a virtualenv though, will be really helpful. Use this to get started

Moulick
  • 4,342
  • 1
  • 13
  • 19
0

You may have multiple Python versions installed.

Use pip2.7 to see if this installs on the right python version.

Check this post: pip: dealing with multiple Python versions?

Community
  • 1
  • 1
hasanzuav
  • 554
  • 5
  • 15
  • I tried doing `pip2.7 install MySQL-python`. The response I got :- `Requirement already satisfied: MySQL-python in /usr/local/lib/python2.7/site-packages` – tuk Mar 30 '17 at 06:37
  • 1
    Did you check if your pyCharm was using the right python environment? Check the other answer. – hasanzuav Mar 30 '17 at 06:38
  • Updated the question. – tuk Mar 30 '17 at 07:05