I can install numpy or pandas, but I can't import them in cmd, jupyter notebook or sublime text. (However, I can install and import them in Pycharm).
I've already searched different forums/stackoverflow, seeking for an answer, but the most common causes like architecture mismatch (I use Python 32-bit) or spaces in paths seem not to be the issue here.
I've tried reinstall Python, but it didn't solve the problem.
The error always points out at "ctypes" lib and it seems to be a problem with numpy module specifically. When I try to import pandas/matplotlib it fails with importing numpy.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:UsersjadwiAppDataRoamingPythonPython37site-packages
umpy\__init__.py", line 142, in <module>
from . import core
File "C:UsersjadwiAppDataRoamingPythonPython37site-packages
umpycore\__init__.py", line 23, in <module>
WinDLL(os.path.abspath(filename))
File "C:UsersjadwiAppDataLocalProgramsPythonPython37-32libctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
>>> help('numpy')
problem in numpy - OSError: [WinError 193] %1 is not a valid Win32 application
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:UsersjadwiAppDataLocalProgramsPythonPython37-32libsite-packagespandas\__init__.py", line 13, in <module>
__import__(dependency)
File "C:UsersjadwiAppDataRoamingPythonPython37site-packages
umpy\__init__.py", line 142, in <module>
from . import core
File "C:UsersjadwiAppDataRoamingPythonPython37site-packages
umpycore\__init__.py", line 23, in <module>
WinDLL(os.path.abspath(filename))
File "C:UsersjadwiAppDataLocalProgramsPythonPython37-32libctypes\__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
I know people had this error before, but, as I mentioned, it seems not to be an architecture mismatch problem, there are no spaces in the paths and I'm really stuck with it. Any suggestions on how to solve it will be very appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…