OSError: [WinError 193] %1 不是有效的 Win32 应用程序 - nltk [英] OSError: [WinError 193] %1 is not a valid Win32 application - nltk
问题描述
所以,我不断收到此错误:
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
这是我要运行的代码.
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))
编辑 2:我的操作系统是 Windows 10 并在 x64 上运行
Edit 2: My os is Windows 10 and running on x64
推荐答案
我在使用 win_64 位时遇到了相同的操作系统错误,并且我同时安装了 32 位和 64 位 python.问题肯定出在 nltk 模块上.
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.
在 nltk 文档中,[nltk 网页] (https://www.nltk.org/install.html) 建议安装 Windows 32 位版本的 python.试试 python 32.
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.
这篇关于OSError: [WinError 193] %1 不是有效的 Win32 应用程序 - nltk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!