简体   繁体   English

如何在python 3.6中安装keras?

[英]how to install keras in python 3.6?

我在为 python 3.6 安装 keras 库时遇到问题,每当我尝试安装 keras 时,它都会抛出一个错误,当在互联网上搜索时,keras 已经发布到 python 3.5,有人有解决方案吗?

follow this method if you have anaconda and python version 3.6如果您有 anaconda 和 python 3.6 版,请遵循此方法

first Create a new conda environment首先新建一个conda环境

conda create -n keras python=3.5

Now activate it:现在激活它:

source activate keras

and install keras:并安装keras:

conda install keras

test if it works测试它是否有效

    $ python 
>>>import keras

you will get the following message if sucessfull如果成功,您将收到以下消息

Using TensorFlow backend.

click here to see the Mike Muller's answer单击此处查看 Mike Muller 的回答

I used sudo pip install keras to download.我使用sudo pip install keras下载。

I have both python 2.7 and 3.6 installed on my Mac.我的 Mac 上同时安装了 python 2.7 和 3.6。 I used pip -V to check my python version of installation.我使用pip -V来检查我的 python 安装版本。 Probably you used invalid version of python to download.可能你下载的python版本无效。

Screenshot of the install being done on my computer:在我的电脑上完成安装的屏幕截图:Mac安装截图

Follow the below steps , Tensorflow dosnt support py3.7 as of now , so 3.6 is better ,按照以下步骤,Tensorflow 目前不支持 py3.7,所以 3.6 更好,
I recommend using environment , (venv , conda(preferred) ),我建议使用 environment , (venv , conda(preferred) ),

For conda对于康达

conda create -n keras python=3.6
source activate keras
conda install tensorflow keras
#for faster installation
pip install keras


For virtualenv对于虚拟环境

virtualenv -p python3 keras
source keras/bin/activate
pip install keras tensorflow numpy

Try the following at a command prompt:在命令提示符下尝试以下操作:

pip install --upgrade tensorflow
pip install --upgrade keras

Also, refer the following link for more detail:此外,请参阅以下链接了解更多详情:

https://www.tensorflow.org/install/pip https://www.tensorflow.org/install/pip

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

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