【问题标题】:Module Not Getting Installed: pip3 install morphy模块未安装:pip3 install morphy
【发布时间】:2021-05-31 17:11:17
【问题描述】:

我想在 Ubuntu 20.04.2 上安装 python 模块 morphy,但出现错误。

我试过了:

pip3 install morphy

我得到了这个输出:

Collecting morphy
  Using cached morphy-0.2.tar.gz (9.3 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-uygwfbh3/morphy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-uygwfbh3/morphy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-uygwfbh3/morphy/pip-egg-info
         cwd: /tmp/pip-install-uygwfbh3/morphy/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-uygwfbh3/morphy/setup.py", line 3, in <module>
        with open('README.md', 'r') as fp:
    FileNotFoundError: [Errno 2] No such file or directory: 'README.md'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

它在 Windows 10 上运行。我的 pip3 版本是:

pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

我也试过这个:

pip install morphy

我得到了这个输出:

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting morphy
  Using cached morphy-0.2.tar.gz (9.3 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ICmImS/morphy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ICmImS/morphy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-lPhE0U
         cwd: /tmp/pip-install-ICmImS/morphy/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-ICmImS/morphy/setup.py", line 3, in <module>
        with open('README.md', 'r') as fp:
    IOError: [Errno 2] No such file or directory: 'README.md'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

从输出中可以清楚地看出,包中缺少 README.md 文件。我该怎么办?

【问题讨论】:

  • pip install --upgrade setuptools 你可以试试这个然后再在ubuntu中安装morphy
  • 您的问题提供了指向morphypypi 上的页面的链接,该页面表示需要 Python 3.3 或更高版本。这就解释了在 2.7 上安装失败的原因。

标签: python python-3.x python-2.7 pip


【解决方案1】:

看起来该软件包的 Linux 版本可能已损坏,并且似乎不再维护。 您可以使用以下解决方法:

  1. 尝试再次安装,但告诉 pip 不要清理临时文件:pip install morphy --no-clean
  2. 进入包含包内容的临时目录 - 在pip install 命令的输出中找到它的名称
  3. 创建文件setup.py需要
  4. 手动执行python setup.py install
  5. 如果您知道此软件包的要求,请手动安装它们
$ pip install morphy --no-clean
Collecting morphy
  Using cached morphy-0.2.tar.gz (9.3 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/user/env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vluz3ja_/morphy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vluz3ja_/morphy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-vluz3ja_/morphy/pip-egg-info
         cwd: /tmp/pip-install-vluz3ja_/morphy/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-vluz3ja_/morphy/setup.py", line 3, in <module>
        with open('README.md', 'r') as fp:
    FileNotFoundError: [Errno 2] No such file or directory: 'README.md'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
$ cd /tmp/pip-install-vluz3ja_/morphy
$ touch README.md
$ touch requirements.txt
$ python setup.py install
...
Installed /home/user/env/lib/python3.8/site-packages/morphy-0.2-py3.8.egg
Processing dependencies for morphy==0.2
Finished processing dependencies for morphy==0.2

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-16
    • 1970-01-01
    • 2018-04-25
    • 1970-01-01
    • 2021-08-29
    • 2018-05-11
    • 2017-07-07
    • 1970-01-01
    相关资源
    最近更新 更多