OSError:[WinError 193]%1不是有效的Win32应用程序-nltk

问题描述 投票:0回答:1

所以,我不断收到此错误:

OSError: [WinError 193] %1 is not a valid Win32 application

我认为是因为我的环境变量。因此,我已修复该问题,但仍会继续收到错误消息。我现在不知所措。这是完整的错误输出:

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))
python python-3.x nltk corpus
1个回答
0
投票
也许您的计算机的操作系统不是window_32,但是您的python适合。因此,请检查您的操作系统,我猜您的操作系统是window_64,然后安装正确的python版本。
这里是window_64的python安装程序。

python installer for win_64

© www.soinside.com 2019 - 2024. All rights reserved.