可以从pipenv安装特定版本的Tensorflow,但无法从Pipfile安装

问题描述 投票:0回答:2

非常奇怪的错误,我可以使用命令从pipenv安装

tensorflow==2.4.1

pipenv install tensorflow==2.4.1

但是当我将其放入以下格式的 pipfile 中时:

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

[packages]
tensorflow = "==2.4.1"

[requires]
python_version = "3.8"

我运行命令:

pipenv lock --clear
pipenv --rm 
pipenv install

我得到:

Pipfile.lock (bf56f7) out of date, updating to (0575f6)...
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
CRITICAL:pipenv.patched.notpip._internal.index.package_finder:Could not find a version that satisfies the requirement tensorflow==2.4.1 (from -r /var/folders/m6/kqrmfdj12x79gmbbq6f2m1ph0000gn/T/pipenvxgupglu4requirements/pipenv-puyj_a_j-constraints.txt (line 2)) (from versions: none)
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/resolver.py", line 741, in _main
[ResolutionFailure]:       resolve_packages(pre, clear, verbose, system, write, requirements_dir, packages, dev)
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/resolver.py", line 702, in resolve_packages
[ResolutionFailure]:       results, resolver = resolve(
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/resolver.py", line 684, in resolve
[ResolutionFailure]:       return resolve_deps(
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/utils.py", line 1395, in resolve_deps
[ResolutionFailure]:       results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/utils.py", line 1108, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/usr/local/Cellar/pipenv/2020.11.15/libexec/lib/python3.9/site-packages/pipenv/utils.py", line 833, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  First try clearing your dependency cache with $ pipenv lock --clear, then try the original command again.
 Alternatively, you can use $ pipenv install --skip-lock to bypass this mechanism, then run $ pipenv graph to inspect the situation.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: No matching distribution found for tensorflow==2.4.1 (from -r /var/folders/m6/kqrmfdj12x79gmbbq6f2m1ph0000gn/T/pipenvxgupglu4requirements/pipenv-puyj_a_j-constraints.txt (line 2))

我致力于让 Pipenv 发挥作用,并且不接受其他包管理解决方案。

python-3.x python-3.8 pypi pipenv tensorflow2.x
2个回答
2
投票

我自己也在努力解决这个问题,因为我希望它像requirements.txt或其他语言包管理器风格一样,我在这里找到了解决方案https://pipenv.pypa.io/en/latest/advanced/

这样你的 Pipfile 将变成

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

[packages]
tensorflow = {version="==2.4.1"}"

[requires]
python_version = "3.8"

0
投票

您可以使用命令pipenv run:

pipenv run pip install tensorflow==2.4.1
© www.soinside.com 2019 - 2024. All rights reserved.