【问题标题】:How to install Morfeusz2 for Python on Windows?如何在 Windows 上安装 Morfeusz2 for Python?
【发布时间】:2019-03-22 15:45:58
【问题描述】:

根据提供的user manual(翻译自波兰语),我正在尝试在 Windows 上为 Python 3.7 安装 Morfeusz2 egg:

可以使用从网站下载的 .egg 文件中的 easy_install 命令安装 Python 模块(适用于相应的 Python 版本)。 .egg 文件还包含带有 SGJP 字典的 Morfeusz 库,因此您无需在 Windows 下安装其他模块即可仅从 Python 级别使用 Morfeusz。

很遗憾,安装失败

python -m easy_install http://sgjp.pl/morfeusz/download/20181014/ubuntu-xenial/morfeusz2-0.4.0-py2.7-win32.egg
Downloading http://sgjp.pl/morfeusz/download/20181014/ubuntu-xenial/morfeusz2-0.4.0-py2.7-win32.egg
Processing morfeusz2-0.4.0-py2.7-win32.egg
removing 'c:\users\oem\appdata\local\programs\python\python37-32\lib\site-packages\morfeusz2-0.4.0-py2.7-win32.egg' (and everything under it)
creating c:\users\oem\appdata\local\programs\python\python37-32\lib\site-packages\morfeusz2-0.4.0-py2.7-win32.egg
Extracting morfeusz2-0.4.0-py2.7-win32.egg to c:\users\oem\appdata\local\programs\python\python37-32\lib\site-packages
Removing morfeusz2 0.4.0 from easy-install.pth file
Adding morfeusz2 0.4.0 to easy-install.pth file

Installed c:\users\oem\appdata\local\programs\python\python37-32\lib\site-packages\morfeusz2-0.4.0-py2.7-win32.egg
Processing dependencies for morfeusz2==0.4.0
Searching for morfeusz2==0.4.0
Reading https://pypi.python.org/simple/morfeusz2/
Couldn't find index page for 'morfeusz2' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
No local packages or working download links found for morfeusz2==0.4.0
error: Could not find suitable distribution for Requirement.parse('morfeusz2==0.4.0')

我认为可以忽略安装错误,但看起来 mobule 只安装了部分。尝试调用它时:

import morfeusz2
morf = morfeusz2.Morfeusz()

我收到以下错误:

Traceback (most recent call last):
  File "D:\Projects-intellij\mysite\ingredients.py", line 4, in <module>
    import morfeusz2
  File "C:\Users\OEM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\morfeusz2-0.4.0-py2.7-win32.egg\morfeusz2.py", line 28, in <module>
    _morfeusz2 = swig_import_helper()
  File "C:\Users\OEM\AppData\Local\Programs\Python\Python37-32\lib\site-packages\morfeusz2-0.4.0-py2.7-win32.egg\morfeusz2.py", line 24, in swig_import_helper
    _mod = imp.load_module('_morfeusz2', fp, pathname, description)
  File "C:\Users\OEM\AppData\Local\Programs\Python\Python37-32\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\OEM\AppData\Local\Programs\Python\Python37-32\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: Nie można odnaleźć określonego modułu.

如何诊断和解决根本原因?

【问题讨论】:

    标签: python dll egg


    【解决方案1】:

    在引用的命令中,您使用文件 morfeusz2-0.4.0-py2.7-win32.egg,该文件适用于 Python 2.7 (py2.7) 但不适用于 3.7。

    其他版本的 Python 的 Eggs 可在此处获得: http://sgjp.pl/morfeusz/download/20181014/ubuntu-xenial/ 较新的版本将出现在类似的目录中(将 20181014 替换为代表上周日的字符串)。 我们希望更新下载页面以列出所有可用版本,但尚未完成。

    【讨论】:

    • 谢谢!另一个问题是“DLL 不是有效的 Win32 应用程序”,因为该库是 64 位的,而我使用的是 Python 3.7-32 位版本。安装 Python 37-64bit 解决了这个问题。
    • 我想使用 pip 安装这个库,但是 pip 只支持 sdist(用于源代码分发)和 Wheels(用于二进制包),而不支持 Eggs。您是否计划支持与 pip 兼容的格式?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-03-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-18
    相关资源
    最近更新 更多