Adding python modules to pydev in eclipse results in import error?

前端 未结 11 2094
难免孤独
难免孤独 2020-12-14 03:01

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

相关标签:
11条回答
  • 2020-12-14 03:31

    @Aufwind your answer above helped but didn't solve for me.

    • Find the path to the folder ../site-packages/ ....
    • Open eclipse preferences and go to PyDev -> Interpreter - Python.
    • On the left side of the lower box, click on New Folder. ---> here I departed from your instructions. I added the egg for the module that wasn't being recognized. Adding the site-packages folder didn't fix it.
    • Hit open.
    • Hit Apply.
    • Hit Ok.

    And then I was good to go. =)

    0 讨论(0)
  • 2020-12-14 03:31
    1. Open eclipse window -> preferences and go to PyDev -> Interpreter.
    2. click on 'Check if interpreters are synchronized with environment'

    This did it for me. No Eclipse restart was required.

    0 讨论(0)
  • 2020-12-14 03:40

    Suppose your eternal module is in /.

    Launch Eclipse and go to the project option. Select "PyDev-PYTHONPATH" and on the right you will see a tabbed window. Select External Libraries there. Click on Add Source Folder and select your library from the above path.

    0 讨论(0)
  • 2020-12-14 03:41

    You can simply add the module to the pydev path. Go to project properties (from the context menu) -> PyDev -> PYTHONPATH -> External Libraries. Depending on whether the module is in a source folder or a zip/egg file, select either Add source folder or Add zip/jar/egg. Navigate to the site-packages directory and point to the relevant file or folder (mine is: /usr/local/lib/pythonx.x/site-packages)

    0 讨论(0)
  • 2020-12-14 03:43

    I fixed this problem by going to the project properties -> PyDev Django and setting the Django settings module.

    0 讨论(0)
提交回复
热议问题