OSError: [WinError 193] %1 is not a valid Win32 application - when trying to import numpy

后端 未结 4 1471
一整个雨季
一整个雨季 2021-01-14 21:02

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

相关标签:
4条回答
  • 2021-01-14 21:03

    I'm using PyCharm, determined to learn the PipEnv virtualization tool(it utilizes SHA256 hashing against downloaded packages), and was experiencing this same exact error message (error 193, %1 not a valid win32 or whatever). I realize this isn't exactly your scenario however, you're using python and PyCharm so I figure it might and might help others who arrive here. Anyways...

    The way I resolved it was by: 1.) in the 'Add Python Interpreter' window (first setting up virtualization interpreter), I had to put "C:\Users\ericm\AppData\Roaming\Python\Python38\Scripts\pipenv.exe" as my "Pipenv executable'. (After doing this, I began getting a permission error when trying to utilize it) 2.) I had to add my project's path into the "Working directory" (e.x. C:\Users\ericm\OneDrive\Documents\Programming\Python\NameOfProject)

    No more errors of any kind and my app is fully working again.

    0 讨论(0)
  • 2021-01-14 21:09

    Reinstalling numpy did not work for me.

    I had the same issue and noticed multiple paths pointing to numpy in the error message. E.g.

    C:\Users\USERNAME\AppData\Roaming\Python\Python37\*
    C:\Users\USERNAME\AppData\Local\Programs\Python\Python37-32\*
    

    I deleted the C:\Users\USERNAME\AppData\Roaming\Python\Python37\* folder because that was left behind by a previous Python which I had uninstalled. I would not recommend deleting anything until you are certain you won't break other things, so maybe send it to the recycle bin and restore if it does not fix the issue for you.

    0 讨论(0)
  • 2021-01-14 21:24

    You can try this, I solved my problem after update package.

    pip install --upgrade numpy
    

    if nothing changed, you can upgrade pip first, than upgrade numpy.

    python -m pip install --upgrade pip 
    

    (if you want to update all package, please refer to this page:How to upgrade all Python packages with pip?)

    Or check the python version is fit your environment or not. Please make sure you remove old version totally after you reinstall new version.

    0 讨论(0)
  • 2021-01-14 21:29

    Okay, so this eventually helped me:

    1. I uninstalled only a numpy module with "pip uninstall numpy",

    2. I reinstalled it once again with "pip install numpy",

    3. I ran python, imported just one function from numpy (as I thought that maybe just some of the functions can't be imported, not entire numpy) - "from numpy import array"

    4. The function worked,so I tried to import the entire numpy once again and this time it succeeded without OSError.

    0 讨论(0)
提交回复
热议问题