我正在尝试使用 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位。
我在做什么错了?
答案 0 :(得分:3)
正如评论所指出的那样,Tensorflow仅支持python 3.7(截至2020年3月)。您可以在文档的system requirements page中找到更多信息。
因此,要解决您的问题,
pipenv --rm
删除虚拟环境[requires]
python_version = "3.7"
pipenv install --dev
再次重新创建环境,运行pipenv install tensorflow
安装tensorflow 完成!