Saturday, October 5, 2019

Eclipse Complains "ImportError: DLL Load failed"

When I ran a Python program in a PyDev project in Eclipse, I encountered the following error:

ImportError: DLL load failed: The specified module could not be found.

It turns out that the PATH (or path in UNIX systems) in environment variable does contain the path where the DLL files required by the package imported in the Python program are in. Knowing this, I resolve it by adding the path to the environment variable.

Instead of adding it to the system path environment variable, I added it to the Eclipse "run-as" configuration, e.g., right-click on the Python program we want to run, select "Run As", click on "Run Configuration", click on the "Environment" tab, click at the "Select" button, check the "Path" variable, bring up the edit dialog window, and add the DLL path value to the existing value.

I am using Anaconda3 in a Windows 10 host and installed it at C:\Applications\Anaconda3. In this case, the DLL path value I added is C:\Applications\Anaconda3\Library\bin

No comments:

Post a Comment