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