Home > database >  Python do not recoganize numpy
Python do not recoganize numpy

Time:12-30

i am trying to use the package numpy, but when i run the code i have this error (the message appears just with the import numpy):

Traceback (most recent call last):
  File "D:\OneDrive\Programacao\esforcos_estacas.py", line 2, in <module>
    import numpy
  File "D:\OneDrive\Programacao\venv\lib\site-packages\numpy\__init__.py", line 148, in <module>
    from . import _distributor_init
  File "D:\OneDrive\Programacao\venv\lib\site-packages\numpy\_distributor_init.py", line 26, in <module>
    WinDLL(os.path.abspath(filename))
  File "C:\Users\muril\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 não é um aplicativo Win32 válido

CodePudding user response:

You have a 32bit version of Python and you're trying to use a 64bit version of numpy. Either replace the 32bit version of python with a 64bit one, or install the 32bit version of numpy.

If your version of Windows is 32bit then you'll need to install 32bit numpy.

Installing it with a package manager like pip or conda should get the correct version automatically.

CodePudding user response:

I would try uninstalling and reinstalling numpy with both PIP and conda in that order. Usually that solves most issues with packages loading. What environment are you using as well? Some packages only work on certain operating systems.

Try

pip uninstall numpy
conda uninstall numpy
conda install numpy
pip uninstall numpy
conda uninstall numpy
pip install numpy
  • Related