<p>我对一直运行的脚本使用<code>pyhyphen</code>包。最近,我更新了MacOS Big Sur。Spyder很落后,但我通过运行一个虚拟环境和<code>pip install</code>我需要的东西来解决这个问题。没有问题</p>
<p>现在,当我尝试运行<code>from hyphen import Hyphenator</code>(<a href="https://pypi.org/project/PyHyphen/#id3" rel="nofollow noreferrer">here is the package page</a>)时,出现以下错误:</p>
<pre><code>[autoreload of hyphen.dictools failed: Traceback (most recent call last):
File "/Users/myname/anaconda3/lib/python3.8/site-packages/IPython/extensions/autoreload.py", line 245, in check
superreload(m, reload, self.old_objects)
File "/Users/myname/anaconda3/lib/python3.8/site-packages/IPython/extensions/autoreload.py", line 394, in superreload
module = reload(module)
File "/Users/myname/anaconda3/lib/python3.8/imp.py", line 314, in reload
return importlib.reload(module)
File "/Users/myname/anaconda3/lib/python3.8/importlib/__init__.py", line 159, in reload
raise ImportError(msg.format(parent_name),
ImportError: parent 'hyphen' not in sys.modules
]
runcell(0, '/Users/myname/Documents/project/project.py')
Traceback (most recent call last):
File "/Users/myname/Documents/project/project.py", line 17, in <module>
from hyphen import Hyphenator
File "/Users/myname/anaconda3/lib/python3.8/site-packages/hyphen/__init__.py", line 10, in <module>
from .hyphenator import Hyphenator
File "/Users/myname/anaconda3/lib/python3.8/site-packages/hyphen/hyphenator.py", line 27, in <module>
from . import hnj
RuntimeError: invalid slot offset
</code></pre>
<p><code>from hyphen import Hyphenator</code>是脚本中唯一的一行。我已经尝试卸载/重新安装该软件包600次了,但我找不到任何解决方案。所有其他软件包导入良好,没有问题</p>
<p>Spyder(在Anaconda中)正在运行python版本3.8.5。我安装了non-anaconda 3.9,但我无法想象这会有任何效果,因为我在虚拟环境中运行spyder</p>