简体   繁体   English

无法在 Python 虚拟环境中安装 TensorFlow

[英]Unable to install TensorFlow in Python Virtual Environment

Salutations!问候!

I am getting an error when attempting to install TensorFlow in a Python virtualenv.尝试在 Python virtualenv 中安装 TensorFlow 时出现错误。 I created a Python 3.7 virtual environment for a data project that I'm working on.我为我正在处理的数据项目创建了一个 Python 3.7 虚拟环境。 I tried installing TensorFlow into that environment and I received the following error:我尝试将 TensorFlow 安装到该环境中,但收到以下错误:

ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/34/d5/ce8c17971067c0184c9045112b755be5461d5ce5253ef65a367e1298d7c5/tensorflow-2.1.0-cp37-cp37m-win_amd64.whl (Caused by ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)))

I'm guessing this may be due to me being on a work network, which may have firewall restrictions, but I am not totally sure.我猜这可能是因为我在工作网络上,可能有防火墙限制,但我不完全确定。

Any insight would be greatly appreciated.任何见解将不胜感激。

Gratitude!感激!

You can try either the command,您可以尝试任一命令,

pip install --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --upgrade tensorflow

or the Command,或命令,

pip install --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --upgrade --proxy=127.0.0.1:3128 tensorflow

For more information, please refer this Github Issue and this Stack Overflow Issue .有关更多信息,请参阅此Github 问题和此Stack Overflow 问题

Hope this helps.希望这可以帮助。 Happy Learning for Tensorflow . Tensorflow的快乐学习。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM