Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
624 views
in Technique[技术] by (71.8m points)

import - Unable to load DLL python module in PyCharm. Works fine in IPython

When I use the IPython included with Enthought Python Distribution, I can import the pyvision package just fine. However, when I try to import pyvision inside of PyCharm 1.2.1, I get the following errors

  File "C:Python27libsite-packagespyvision\__init__.py", line 146, in <module>
    from pyvision.types.img import Image,OpenCVToNumpy,NumpyToOpenCV
  File "C:Python27libsite-packagespyvisionypesimg.py", line 43, in <module>
    import numpy
  File "C:Python27libsite-packages
umpy\__init__.py", line 142, in <module>
    import add_newdocs
  File "C:Python27libsite-packages
umpyadd_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "C:Python27libsite-packages
umpylib\__init__.py", line 13, in <module>
    from polynomial import *
  File "C:Python27libsite-packages
umpylibpolynomial.py", line 17, in <module>
    from numpy.linalg import eigvals, lstsq
  File "C:Python27libsite-packages
umpylinalg\__init__.py", line 48, in <module>
    from linalg import *
  File "C:Python27libsite-packages
umpylinalglinalg.py", line 23, in <module>
    from numpy.linalg import lapack_lite
ImportError: DLL load failed: The specified module could not be found.

Am I missing some path settings in Windows?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same problem. I'm using Winpython32 and trying to import win32com. Worked everywhere (I tried) except in PyCharm. sys.path and os.environ['PYTHONPATH'] had some extra entries inside Pycharm, but nothing is missing compared to when run elsewhere.

The solution was to start Pycharm within the Winpython console and not using the shortcut.

sys.path and os.environ['PYTHONPATH'] did not change. os.environ['PATH'] had several additional entries set, all related to the python installation. At this point I suspect it has to do with "non-standard" installations. Winpython32 tries to be "portable", while other reports of similar problems are when using Enthought or Python(x,y).

Manually adding:

 C:WinPython-32python-2.7.6
 C:WinPython-32python-2.7.6DLLs
 C:WinPython-32python-2.7.6Scripts

to the system path (the global PATH environment variable in Windows) solved the problem without having to run Pycharm within the Winpython command line. Note: C:WinPython-32python-2.7.6Scripts alone did not solve it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...