gpt4 book ai didi

python - Pipenv install 不会安装 Pipfile 中的所有内容

转载 作者:行者123 更新时间:2023-12-05 06:12:52 25 4
gpt4 key购买 nike

我在全新的 Ubuntu 20.04 安装上运行它:

pipenv 安装使用 Pipfile:

$ cat Pipfile
[packages]
Django = "*"
django-split-settings = "*"
python-dotenv = "*"
django-compressor = "*"
django-libsass = "*"
Brotli = "*"
django-htmlmin = "*"
gunicorn = "*"
dj-database-url = "*"
wagtail = "*"
wagtail-metadata = "*"
wagtail-blocks = "*"
psycopg2 = "*"
django-tz-detect = "*"
wagtailcodeblock = "*"
django-taggit = "*"
django-taggit-templatetags2 = "*"
django-fontawesome-5 = "*"
django-debug-toolbar = "*"
wagtail-robots = "*"
wand = "*"

[dev-packages]
pylint = "*"
django-debug-toolbar = "*"

[requires]
python_version = "3.7"

[packages.whitenoise]
extras = [ "brotli",]

[packages.django-storages]
extras = [ "dropbox",]

然后运行:

$ pipenv run pip list
Package Version
--------------- -------
django-storages 1.9.1
pip 20.2.2
setuptools 49.6.0
wheel 0.35.1
whitenoise 5.2.0

它出于某种原因只安装 whitenoise 和 django-storages,我该如何解决这个问题?

补充信息:

$ which python
/home/maks/.local/share/virtualenvs/personal-website-lhNGB4ub/bin/python

$ which pip
/home/maks/.local/share/virtualenvs/personal-website-lhNGB4ub/bin/pip

$ pyenv which python
/home/maks/.pyenv/versions/3.7.8/bin/python

这个问题最近在 Windows 上开发了一段时间后突然出现,当它发生时我切换到只使用 requirements.txt 文件,但现在我想回到使用 pipenv。

据我所知,这不是文件编码或行尾的问题,我不确定这究竟是何时/为何开始发生的。

编辑:运行 pipenv install django 将正确安装 django,但 pipfile 和 pipfile.lock 保持相同,这意味着这不是 Pipfile 的问题

最佳答案

修复:所以有效的方法是删除 pipfile 并使用 pipenv install 手动重新安装每个包,这导致 pipfile 看起来略有不同,从外观上看是导致我出现此问题的原因,是对 pipenv 的更新本身...看看:

旧的 Pipfile:

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

[requires]
python_version = "3.7"

[packages]
Django = "*"
django-split-settings = "*"
python-dotenv = "*"
django-compressor = "*"
django-libsass = "*"
Brotli = "*"
django-htmlmin = "*"
dj-database-url = "*"
wagtail = "*"
wagtail-metadata = "*"
wagtail-blocks = "*"
psycopg2 = "*"
django-tz-detect = "*"
wagtailcodeblock = "*"
django-taggit = "*"
django-taggit-templatetags2 = "*"
django-fontawesome-5 = "*"
django-debug-toolbar = "*"
wagtail-robots = "*"
wand = "*"
gunicorn = "*"

[dev-packages]
pylint = "*"
django-debug-toolbar = "*"

[packages.whitenoise]
extras = [ "brotli",]

[packages.django-storages]
extras = [ "dropbox",]

在新环境中手动重新安装每个包后:

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

[dev-packages]
pylint = "*"
django-debug-toolbar = "*"

[packages]
django = "*"
django-split-settings = "*"
python-dotenv = "*"
django-compressor = "*"
django-libsass = "*"
brotli = "*"
django-htmlmin = "*"
dj-database-url = "*"
wagtail = "*"
wagtail-metadata = "*"
wagtail-blocks = "*"
django-tz-detect = "*"
wagtailcodeblock = "*"
django-taggit = "*"
django-taggit-templatetags2 = "*"
django-fontawesome-5 = "*"
django-debug-toolbar = "*"
wagtail-robots = "*"
wand = "*"
whitenoise = {extras = ["brotli"], version = "*"}
django-storages = {extras = ["dropbox"], version = "*"}
gunicorn = "*"

[requires]
python_version = "3.7"

使用 pipenv install 从这个 pipfile 安装工作正常,并且安装了所有包。

我不确定为什么会发生这一切,也许是 pipenv 中的错误,或者可能没有向后兼容性。如果有人知道请告诉我。

如果你想在不重新安装每个包的情况下解决这个问题,你可以像这样简单地替换位:

[packages.whitenoise]
extras = [ "brotli",]

并将它们转换成这种格式:

whitenoise = {extras = ["brotli"], version = "*"}

完成后运行 pipenv install 并且所有依赖项都将正确安装

我在 Pipenv 存储库上提交了一个问题:https://github.com/pypa/pipenv/issues/4433

关于python - Pipenv install 不会安装 Pipfile 中的所有内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63539443/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com