简体   繁体   English

Anaconda3在安装Tensorflow时出现问题

[英]Anaconda3 issues installing Tensorflow

I am trying to install Tensorflow on Windows 10 using Anaconda3. 我正在尝试使用Anaconda3在Windows 10上安装Tensorflow。

I get the following error message after every attempt. 每次尝试后,我都会收到以下错误消息。

 "Command "python setup.py egg_info" failed with error code 
 3221226505 in C:\Users\user\AppData\Local\Temp\pip-install- 
 8j_eg21o\termcolor\"

I Create a new Anaconda Container and tried running the following. 我创建一个新的Anaconda容器并尝试运行以下内容。

 "python -m pip install tensorflow"
 "python -m pip install tensorflow==1.7.1"
 "python -m pip install --upgrade tensorflow"

There are some information on the internet stating my Setup Tools is out of date. 互联网上有一些信息表明我的安装工具已过期。 I tried to correct this by using the Following commands. 我试图通过使用以下命令来更正此问题。

 "pip install --upgrade setuptools"
 "python -m pip install --upgrade pip"

It does not correct the error message. 它不会更正错误消息。 Is there any Python Guru's that will be able to solve my issue? 是否有任何Python Guru可以解决我的问题? Thanks in advance. 提前致谢。

Anaconda is there for such issues. Anaconda可以解决此类问题。 You ought not use pip to install packages unless it is the last resort. 除非万不得已,否则不应该使用pip来安装软件包。 conda helps you avoid colliding packages. conda可帮助您避免程序包冲突。 Do: 做:

conda update conda
conda create -n tensor python=3.6

We first updated conda, and then created an environment called tensor that has Python 3.6. 我们首先更新了conda,然后创建了一个名为tensor的环境,该环境具有Python 3.6。

To activate our environment, install and test if we can use tensorflow, do: 要激活我们的环境,请安装并测试是否可以使用tensorflow,请执行以下操作:

conda activate tensor
conda config --append channels conda-forge
conda install tensorflow 
python -c "import tensorflow"

This activates our environment (tensor), appended conda-forge channel, install tensorflow and test if we can import tensorflow. 这将激活我们的环境(张量),附加的conda-forge通道,安装tensorflow并测试是否可以导入tensorflow。

To add other packages eg jupyter, pandas and scikit-learn. 添加其他软件包,例如jupyter,pandas和scikit-learn。 We can do: 我们可以做的:

conda install -n tensor jupyter pandas scikit-learn

This works in or out of our tensor environment. 这可以在我们的张量环境中使用或在其中使用。 Happy coding. 快乐的编码。

According to this answer , try upgrading setuptools via , 根据此答案 ,尝试通过升级升级setuptools,

easy_install -U setuptools

Since you want to install TensorFlow in an Anaconda environment, I would suggest installing a Conda package. 由于您想在Anaconda环境中安装TensorFlow,因此建议您安装Conda软件包。 You can read the instructions here . 您可以在此处阅读说明。 Installing pip packages invite problems for some packages. 安装pip软件包会引起某些软件包的问题。 Install the TensorFlow Conda package using, 使用以下方法安装TensorFlow Conda软件包

conda install -c conda-forge tensorflow

The conda packages must work as expected. 康达包装必须按预期工作。

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

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