使用pipenv安装TensorFlow会出现错误

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

我正在尝试使用pipenv安装TensorFlow

这是我的Pipfile:

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

[dev-packages]
pylint = "*"

[packages]
python-telegram-bot = "*"
imdbpy = "*"
matplotlib = "*"
scikit-image = "*"
scikit-learn = "*"
tensorflow = "*"

[requires]
python_version = "3.8"

然后我运行:

pipenv install tensorflow

哪个输出:

Installing tensorflow…
Adding tensorflow to Pipfile's [packages]…
Installation Succeeded
Pipfile.lock (989c3d) out of date, updating to (0d6760)…
Locking [dev-packages] dependencies…
Success!
Locking [packages] dependencies…
Locking Failed!

之后是大回溯,结尾为:

pipenv.patched.notpip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in C:\Users\lucas\AppData\Local\Temp\tmpyh639mq4build\functools32\

我的虚拟环境使用Python 3.8.0 64位

我在做什么错?

python tensorflow pipenv
1个回答
0
投票

正如评论所指出,Tensorflow仅支持python 3.7(截至2020年3月)。您可以在文档的system requirements page中找到更多信息。

所以,要解决您的问题:

  1. 使用pipenv --rm删除虚拟环境
  2. 删除Pipfile.lock
  3. 将Pipfile的最后几行更改为
    [requires]
    python_version = "3.7"
    
  4. 再次运行pipenv install --dev以重新创建环境,并运行pipenv install tensorflow以安装tensorflow

完成!

© www.soinside.com 2019 - 2024. All rights reserved.