2017-11-25 139 views
1

我正在使用Google Cloud DataLab,这是运行在Google云计算引擎上的ipython笔记本,我试图安装python模块keras,但笔记本声称找不到它。我正在运行Python3(并且在安装后重新启动内核)。一切似乎都安装在Python2.7文件夹中 - python3内核能否找到它?以下是一些有用的日志和错误消息:在Google云中找不到模块DataLab

print(platform.python_version()) 
!pip install keras==2.1.1 
!pip show keras 
import keras 

3.5.2 
Requirement already satisfied: keras==2.1.1 in /usr/local/lib/python2.7/dist-packages 
Requirement already satisfied: pyyaml in /usr/local/lib/python2.7/dist-packages (from keras==2.1.1) 
Requirement already satisfied: six>=1.9.0 in /usr/local/lib/python2.7/dist-packages (from keras==2.1.1) 
Requirement already satisfied: scipy>=0.14 in /usr/local/lib/python2.7/dist-packages (from keras==2.1.1) 
Requirement already satisfied: numpy>=1.9.1 in /usr/local/lib/python2.7/dist-packages (from keras==2.1.1) 
Name: Keras 
Version: 2.1.1 
Summary: Deep Learning for Python 
Home-page: https://github.com/fchollet/keras 
Author: Francois Chollet 
Author-email: [email protected] 
License: MIT 
Location: /usr/local/lib/python2.7/dist-packages 
Requires: pyyaml, six, scipy, numpy 
--------------------------------------------------------------------------- 
ImportError        Traceback (most recent call last) 
<ipython-input-49-02979b1fc374> in <module>() 
    2 get_ipython().system('pip install keras==2.1.1') 
    3 get_ipython().system('pip show keras') 
----> 4 import keras 

ImportError: No module named 'keras' 

回答

1

尝试pip3 install keras==2.1.1

PIP将与PIP的默认版本,这是Python 2.7版安装(您可以用pip -V检查)

PIP3将永远是Python 3版本的pip。