ModuleNotFoundError:没有名为“regex._regex”的模块

ModuleNotFoundError:没有名为“regex._regex”的模块

我花了一整晚的时间试图找到我的代码出错的地方,最后缩小到了这个。这是我收到的完整错误消息:

"Traceback (most recent call last): 
File "/var/www/html/ngram_pos/service/word_service/checker.py", line 11, in import nltk # type: ignore 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/nltk/__init__.py", line 133, in from nltk.text import * 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/nltk/text.py", line 30, in from nltk.tokenize import sent_tokenize 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/nltk/tokenize/__init__.py", line 66, in from nltk.tokenize.casual import TweetTokenizer, casual_tokenize 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/nltk/tokenize/casual.py", line 38, in import regex # https://github.com/nltk/nltk/issues/2409 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/regex/__init__.py", line 1, in from .regex import * 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/regex/regex.py", line 419, in import regex._regex_core as _regex_core 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/regex/_regex_core.py", line 21, in import regex._regex as _regex ModuleNotFoundError: No module named 'regex._regex' "

我在 ubuntu 服务器上运行此程序,版本 22.04。python 版本是 3.10。

源代码是一个PHP文件,其中主要的问题陈述是这样的:

$str_output = shell_exec($command_exec);

在哪里

$command_exec = python3 checker.py 'what ;should ;I ;avoid ;while ;writing ;in ;English ;what should ;should I ;I avoid ;avoid while ;while writing ;writing in ;in English ;what should I ;should I avoid ;I avoid while ;avoid while writing ;while writing in ;writing in English ' ';' 2>&1

checker.py 是 PHP 中的代码通过 shell 运行的 python 文件,其余的问题语句都可以通过错误信息看到,错误信息会全部高亮显示。

进一步阐述:我在 Ubuntu 的本地服务器上工作,所有文件都是提供给我的。

我对这一切还很陌生,所以请告诉我解决这个问题需要哪些信息

相关内容