0

I wanted to use lmdb package in python2.7 on my OSX.

I used pip2 install lmdb to install it. And if I install it multiple times, it will show Requirement already satisfied: lmdb in /usr/local/lib/python2.7/site-packages (0.94).

But then when I open python2.7 in terminal and try to import lmdb, an error came out: ImportError: No module named lmdb.

Why can't I import the package when it's already in the site-packages directory?

Thanks in advance!

paranoider
  • 27
  • 2

1 Answers1

0

This is my post and I think we have the same issue, Trouble importing module in Python 2.7

Try this out:

If you are using Mac, then open application -> Python 2.7 -> run the two command documents, and then open the IDLE. Then you open the file and run, it might work, although it is counterintuitive.

son520804
  • 413
  • 5
  • 11
  • Thank you for your response. I only found one command document in Python 2.7 directory, which is `Update Shell Profile.command`. Were you referring to that? – paranoider Jun 05 '18 at 05:12
  • I'm still not able to `import lmdb` in terminal or python file after opening IDLE first. – paranoider Jun 05 '18 at 05:14
  • Hi, I tried `pip2 install lmdb` again and it installed the package to another directory: `Requirement already satisfied: lmdb in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages` and then everything goes well. I guess this has something to do with the command document you mentioned. Thank you. – paranoider Jun 05 '18 at 05:21
  • Thats a weird thing that if you have already installed Python 3.6 first. And I don't know either why we have to do such weird step to make everything well – son520804 Jun 05 '18 at 17:31