0

我在 AWS SageMaker 中安装安装附魔 C 库时遇到问题。我按照以下步骤操作(我使用 os.system 将命令从 jupyter-notebook -in python language- 发送到终端,并使用 os.popen -for got outputs of terminal- ):

(1)要求“附魔 C 库”回购:

os.propen("yum whatprovides enchant")

上一个片段的答案是:

Loaded plugins: dkms-build-requieres, priorities, update-motd, upgrade-helper,
            : versionlock
Could not retrieve mirrorlist http://repo.us-east-1.amazonaws.com/latest/main/mirror.list error was 14: HTTP Error 403 - Forbidden
Could not retrieve mirrorlist http://repo.us-east-1.amazonaws.com/latest/main/mirror.list error was 14: HTTP Error 403 - Forbidden
1:enchant-1.6.0-5.2.amzn1.i686 : An Enchanting Spell Checking Library
Repo   : amzn-main
1:enchant-1.6.0-5.2.amzn1.x86_64 : An Enchanting Spell Checking Library
Repo   : amzn-main

(2) 安装 enchant-1.6.0-5.2.amzn1.x86_64 包:

os.popen( "sudo yum install enchant -y" )

上一个片段的答案是:

Loaded plugins: dkms-build-requieres, priorities, update-motd, upgrade-helper,
            : versionlock
Could not retrieve mirrorlist http://repo.us-east-1.amazonaws.com/latest/main/mirror.list error was 14: HTTP Error 403 - Forbidden
Could not retrieve mirrorlist http://repo.us-east-1.amazonaws.com/latest/main/mirror.list error was 14: HTTP Error 403 - Forbidden
Resolving Dependencies
--> Running transaction check
---> Package enchant.x86_64 1:1.6.0-5.2.amzn1 will be installed
--> Proecssing Dependecy: libhunspell-1.2.so.0()(64bit) for package: 1:enchant-1.6.0-5.2.amzn1.x86_64
--> Running transaction check
---> Package hunspell.x86_64 0:1.2.8-16.2.amzn1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
enter code here
=======================================================================
Package              Arch      Version            Repository     Size
=======================================================================
Installing:
enchant             x86_64    1:1.6.0-5.2.amzn1   amzn-main        54 k
Instanlling for dependencies:
hunspell            x86_64    1:1.8-16.2.amzn1    amzn-main       191 k

Transaction Summary
=======================================================================
Install 1 Package (+1 Denpendet package)

Total download size: 245 k
Installed size: 514 k
Downloading packages:

所以,最后一步就足以安装附魔 C 库,但是当我尝试在 python 中导入附魔时,我得到以下输出:

import enchant
-------------------------------------------
Import Error: The 'enchant' C library was not found and maybe needs to be installed.
See https://pyenchant.github.io/pyenchant/install.html
for details
4

1 回答 1

0

我发现了错误,遵循的步骤是正确的(安装附魔包),问题是服务器无法访问 repos,因此无法下载包。原因是(我在问题中省略了一个细节:我正在通过 ProQuest 的 TDM Studio 在 aws 服务器中工作)服务器只是从 Anaconda 或 PyPI 存储库下载包。

于 2021-07-14T13:56:48.347 回答