So, I keep getting this error:
OSError: [WinError 193] %1 is not a valid Win32 application
I believed it to be because of my environment variables. So, I fixed that, but still keep getting the error. I'm at a loss currently. Here's the complete error output:
Traceback (most recent call last):
File "c:\Users\angel\Desktop\Programming Related\Python\improvedTherapibot\copyImprovedBot.py", line 5, in <module>
import nltk
File "C:\Users\angel\AppData\Local\Programs\Python\Python38\lib\site-packages\nltk\__init__.py", line 128, in <module>
from nltk.collocations import *
File "C:\Users\angel\AppData\Local\Programs\Python\Python38\lib\site-packages\nltk\collocations.py", line 39, in <module>
from nltk.metrics import (
File "C:\Users\angel\AppData\Local\Programs\Python\Python38\lib\site-packages\nltk\metrics\__init__.py", line 16, in <module>
from nltk.metrics.scores import (
File "C:\Users\angel\AppData\Local\Programs\Python\Python38\lib\site-packages\nltk\metrics\scores.py", line 15, in <module>
from scipy.stats.stats import betai
File "C:\Users\angel\AppData\Roaming\Python\Python38\site-packages\scipy\__init__.py", line 106, in <module>
from . import _distributor_init
File "C:\Users\angel\AppData\Roaming\Python\Python38\site-packages\scipy\_distributor_init.py", line 26, in <module>
WinDLL(os.path.abspath(filename))
File "C:\Users\angel\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
Edit: Here is the code I'm trying to run.
import nltk
from nltk.corpus import wordnet
good_words = []
bad_words = []
for syn in wordnet.synsets("happy"):
for l in syn.lemmas():
good_words.append(l.name())
for syn in wordnet.synsets("sad"):
for l in syn.lemmas():
bad_words.append(l.name())
print(set(good_words))
Edit 2: My os is Windows 10 and running on x64
OSError: [WinError 193] %1 is not a valid Win32 application
Maybe your computer's OS not window_32, But your python is suitable it. So check your OS, I guess your OS is window_64, And install right python version.
Here is python installer for window_64.
I ran into the same OS error using, win_64 Bit and I have both python 32-bit and 64-bit installed. The problem is definitely the nltk module.
on the nltk documentation, the [nltk webpage] ( https://www.nltk.org/install.html ) suggests to install Windows 32-bit versions of python. Try python 32.
I would have just done a comment but I have no reputation.
Also as described in this link make sure you are using a 64 bit console eg
C:\Windows\SysWOW64\cmd.exe
while using pip to install your dependencies. This ensures the 64 bit version of the dependencies is installed. Also make sure you are using Python 64 bits and if loading any external.dll or.so compiled in C it was compiled using 64 bits.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.