I have a problem getting PyDev on eclipse to recognize already installed modules. Here is my detailed approach. The machine is a Mac (Snow Leopard).
In terminal the command
python --version
shows Python 2.6.6.
import unidecode
and
from unidecode import unidecode
work both fine!
I installed PyDev in Eclipse and went to configured the python interpreter (Auto Config). I selected all the proposed packages and hit Apply and Ok.
But eclipse keeps complaining
Traceback (most recent call last):
File "/Users/me/Documents/workspace/myproject/python/pythontest.py", line 12, in <module>
from unidecode import unidecode
ImportError: No module named unidecode
The python file looks like this
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
from unidecode import unidecode
def main():
print unidecode(u"Ågot Aakra")
if __name__ == '__main__':
main()
When I remove the first line in the script
#!/usr/bin/env python
it results into the same error.
Does someone know where the problem lies?
Select/Click Python - Interpreter. Click the Libraries tab (2nd above the bottom pane). Click the New Folder button (topmost, right of the bottom pane). Browse to the courselib folder (added above) in the Browse for Folder pop-up window (C:\Users\yourname\eclipse-workspace\courselib).
Create a new projectGo to File → New → PyDev Project to start a wizard. In the next window that appears, enter the name of your project and select "python" and 3.0"; as the type. Make sure "create default 'src' folder and add it to the pythonpath?" is selected. Click Finish.
This is the solution to my problem:
../site-packages/
of your corresponding python version. ( For me it was /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
for python 2.6 on my Mac with Snoe Leopard.)../site-packages/
of your corresponding python version.And you should be good to go. =)
Thanks @all particionts, who provided hints into the right direction in the comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With