pydev --> interpreters ---> python interpreter

How To Add Python Module Library In Eclipse PyDev

When you develop python application with eclipse PyDev plugin, you always need to use some third party python module libraries. This article will just tell you how to add the third party python module library in your eclipse PyDev project and how to use the library in your source code.

1. Install Python Module Library.

Before you can configure and use third party python module, you need to install it first. You can do it follow below steps.

  1. Open a terminal and execute command pip -help, this will list the hep doc for pip command.
  2. Run pip list command in the terminal, it will list all the installed module libraries.
  3. If your needed python module do not exist in the list, run pip install module_name to install it.
    pip install PyPDF2
  4. If you want to see the detail information about the installed module ( for example the module installed directory ), run pip show module_name command.
    sh-3.2# pip show PyPDF2
    Name: PyPDF2
    Version: 1.26.0
    Summary: PDF toolkit
    Author: Mathieu Fenniak
    Author-email: [email protected]
    License: UNKNOWN
    Location: /Users/zhaosong/anaconda3/lib/python3.6/site-packages
  5. Although you have installed the python module, but if you do not add the module library in PYTHONPATH environment variable, when you execute python application, it will throws error messages like below.
    Traceback (most recent call last):
      File "/Users/zhaosong/Documents/WorkSpace/", line 9, in <module>
        import PyPDF2
    ModuleNotFoundError: No module named 'PyPDF2'

2. Add Python Module Library In Eclipse PyDev Project.

This is something like add jar libraries in eclipse java project.

  1. First you need to add PyDev plugin in eclipse, you can refer How To Run Python In Eclipse With PyDev.
  2. Create a PyDev eclipse project.
  3. Right click the PyDev project name in left package explorer panel. And click Properties menu item in the popup menu list.
    right click pydev project then click properties menu item
  4. Select PyDev – PYTHONPATH item in popup window left panel. Then click the External Libraries tab in right panel.
    add external python module directory in pythonpath system variable
  5. Click Add source folder button to open a dialog. And browse to the folder where the python module library exist. Then click Apply and Close button to make it effective.
    browse to select python module directory
  6. Now when you import the python module in your source code, eclipse editor will automatically prompt the module name for you.

2. Add Python Module Library In Eclipse Globally.

Above method will just add the python module library in the special PyDev project, if you create another PyDev project, you need to add the module lib in the new PyDev project again.

But we can add the python module library globally in all the eclipse PyDev project. So that when you create a new PyDev project, it can use the python module lib directly in source code, no more project settings is needed.

  1. Open eclipse and click Eclipse —> Preferences… menu item in MacOS, or Window —> Preferences in windows.
  2. Select PyDev —> Interpreters —> Python Interpreter menu item in Preferences window left panel.
  3. Click Libraries tab in right panel. Click the New Folder button to browse and select the python module library folder.
  4. After that you can see the module library folder has been added under the System Libs node.
  5. Click Apply and Close button to make it effective.
    pydev --> interpreters ---> python interpreter
  6. Now you can create a new PyDev project, and when you expand the project —> python —> System Libs node, you can see the newly added python module library in it.
    project python system libs


  1. How To Run Python In Eclipse With PyDev.

2 thoughts on “How To Add Python Module Library In Eclipse PyDev”

  1. Another way is to use the Preferences-PyDev-Python Interpreter and click on “Manage with PIP” in the bottom area. For some reason, Eclipse/PyDev/Windows insists on building, say pyaudio, rather than using a wheel so you have to install C++ Version 14 which seems to mean installing a large chunk of Visual Studio.

    I swear, Python development is vastly harder than Java or C++ and it’s only that my Linux box is even more ancient than my Windows machine… I assume that the Linux installers automatically take care of secondary requirements.

  2. You saved me!

    On the Mac, I found that the libs were in a hidden folder, eg:


    These are invisible until you click Shift + Command + “.”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.