python - How do I fix WinError 126 for Pyenchant?
问题描述
I am relatively new to Python. I already know what most things are and do so now I am trying to work on as many projects as I can to get familiar with Python coding.
But here I've run into a speed bump. I'm trying to create something that takes in letters from a user to generate words ranging from 3 letters to the length of the word.
My code is okay, I think, but when I run it I get a WinError 126 and I'm not trying to import any dll files. I reckon it has something to do with Pyenchant. Please, may someone help me??
CODE & ERROR:
from itertools import permutations
import enchant
d = enchant.Dict("en_UK")
WORDS = set()
LETTERS = input("ENTER LETTERS: ")
PERMS = [i.upper() for i in LETTERS]
for n in range(2, len(LETTERS)):
for x in list(permutations(PERMS, n)):
ANAGRAMS = "".join(x)
if d.check(ANAGRAMS):
WORDS.add(ANAGRAMS)
print(WORDS)
_________________________________________________________
Traceback (most recent call last):
File "C:\Users\JAVA MANU\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\WordScapes cheat tool v2.py", line 2, in <module>
import enchant
File "C:\Users\JAVA MANU\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\enchant\__init__.py", line 81, in <module>
from enchant import _enchant as _e
File "C:\Users\JAVA MANU\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\site-packages\enchant\_enchant.py", line 161, in <module>
e = ctypes.cdll.LoadLibrary(enchant_lib_path)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 442, in LoadLibrary
return self._dlltype(name)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\lib\ctypes\__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
解决方案
推荐阅读
- flutter - 有什么方法可以使用一些默认代码创建颤振项目吗?
- python - 从一个文件中对多个文件进行 Doctest
- string - 如何动态更改 Kotlin 循环中的条件
- android - Mpandroidchart 文本未正确显示在折线图的 x 轴上
- powerbi - 日期层次结构选项未显示
- python - 如何从另一个列表创建和更新相同的列表
- spring-boot - Spock 模拟存储库 findAll 总是返回 null
- sql - 使用列的值作为sql中另一列的别名
- python - python .rstrip() 不能按预期工作
- javascript - 如何使用 useContext Hook 共享状态