"pip install models" 失败,错误代码 1“没有名为 'base' 的模块

"pip install models" fails with error code 1 "No module named 'base'

在 Windows 10

上使用 Python 3.9

我需要导入模块“TSheets”,但它会在其依赖项之一上引发异常:

from tsheets.api import TSheets

发生异常:ModuleNotFoundError:没有名为 'models'

的模块

当我尝试安装模型时

pip install models

我得到了输出

Collecting models
  Using cached models-0.9.3.tar.gz (16 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\rober\AppData\Local\Temp\pip-install-utzl8ihq\models_a160fe5c40f44b6180918e508f09440a\setup.py'"'"'; __file__='"'"'C:\Users\rober\AppData\Local\Temp\pip-install-utzl8ihq\models_a160fe5c40f44b6180918e508f09440a\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 'C:\Users\rober\AppData\Local\Temp\pip-pip-egg-info-ijs4wmiu'
         cwd: C:\Users\rober\AppData\Local\Temp\pip-install-utzl8ihq\models_a160fe5c40f44b6180918e508f09440a\
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\rober\AppData\Local\Temp\pip-install-utzl8ihq\models_a160fe5c40f44b6180918e508f09440a\setup.py", line 25, in <module>
        import models
      File "C:\Users\rober\AppData\Local\Temp\pip-install-utzl8ihq\models_a160fe5c40f44b6180918e508f09440a\models\__init__.py", line 23, in <module>
        from base import *
    ModuleNotFoundError: No module named 'base'
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/92/3c/ac1ddde60c02b5a46993bd3c6f4c66a9dbc100059da8333178ce17a22db5/models-0.9.3.tar.gz#sha256=b5aa29c6b57a667cda667dd9fbd33bbd15c14cc285e57dda64f4f4c0fd35e0ae (from https://pypi.org/simple/models/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我在 Windows 上看到过类似的问题,但后来证明是路径问题,但我不确定如何解决这个特殊情况。

我的 Python 3.9 安装在路径 C:\Python39 以避免任何 Windows 用户问题。

我尝试时也遇到错误

pip install base

感谢任何想法或指点!

PyPI 上的 models 包与 TSheets 无关。看到这个问题:

https://github.com/TSheetsTeam/api_python/issues/7

根据从 github 存储库安装它的评论应该修复它:

pip install --upgrade git+https://github.com/TSheetsTeam/api_python.git@301666970a2b70bb43b712923b8e48c412fda13a#egg=tsheets