【问题标题】:pipenv doesn't install GitHub package's dependenciespipenv 不安装 GitHub 包的依赖项
【发布时间】:2019-01-02 02:05:58
【问题描述】:

我有一个 python 包上传到 GitHub。这个包使用 Pipenv 来管理依赖。另一方面,我有一个使用该库的 python 工具(并使用 Pipenv 来管理它自己的依赖项)。

查看我的包的Pipfile,我们可以看到它有两个依赖:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"
loggly-python-handler = "*"

[dev-packages]
pylint = "*"

[requires]
python_version = "3.7"

在我的 python 工具中,我使用以下方法安装了我的包: pipenv install -e git+https://github.com/<name>/<name>.git#egg=<name>

但是,当检查该工具的 pip 图时,我的包似乎没有依赖关系:

(tool-aqleTTYE) C:\Projects\tool>pipenv graph
<my_package>==0.0.3
pylint==2.0.1
  - astroid [required: >=2.0.1, installed: 2.0.1]
    - lazy-object-proxy [required: Any, installed: 1.3.1]
    - six [required: Any, installed: 1.11.0]
    - wrapt [required: Any, installed: 1.10.11]
  - colorama [required: Any, installed: 0.3.9]
  - isort [required: >=4.2.5, installed: 4.3.4]
  - mccabe [required: Any, installed: 0.6.1]

我希望看到我的包依赖于requests 和loggly-python-handler。事实上,在运行代码时,它说它找不到包依赖项..

pipenv run python tool.py

    ....


  File "c:\.virtualenvs\tool-aqlettye\src\tool\tool\logger.py", line 35, in <module>
    'level': 'DEBUG',
  File "c:\python37\Lib\logging\config.py", line 792, in dictConfig
    dictConfigClass(config).configure()
  File "c:\python37\Lib\logging\config.py", line 563, in configure
    '%r' % name) from e
ValueError: Unable to configure handler 'loggly'

为了确定:

(tool-aqleTTYE) C:\Projects\tool>python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'requests'

这是一个错误还是我做错了什么?

【问题讨论】:

    标签: python github package virtualenv pipenv


    【解决方案1】:

    试试:

    pipenv lock --clear
    

    这应该会清除您的锁定文件。 它对我有用。

    刚卸载安装后:

    pipenv uninstall --all
    

    然后

    pipenv install
    

    我第一次创建的自定义包 (.whl) 遇到了同样的问题,但没有在“setup.py”中定义依赖项 (install_requires)。 我将它上传到个人 pypi 存储库并安装它。 在更正我的错误并使用要求更新它并重试安装后,依赖项不起作用。

    我发现锁文件没有显示依赖变化,但“pipenv graph”显示了它们。

    然后我找到了命令here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-29
      • 1970-01-01
      • 1970-01-01
      • 2020-02-23
      • 1970-01-01
      • 1970-01-01
      • 2018-12-27
      • 1970-01-01
      相关资源
      最近更新 更多