Pycharm cannot find installed packages: keras

2019-04-07 21:08发布

I installed pycharm-2016.1.4 in my PC running Ubuntu 14.04. I have installed keras (a python package) using pip install keras and pycharm can find it before. But it cannot find keras now. I do not modify any settings, so this problem may be wired. My python version is python2.7. enter image description here

I use pip list to verify that I have keras installed:

enter image description here

But check this package in pycharm by using: Settings -> Project -> Project Interpreter. Keras is NOT in package list (The interpreter used is the same as the result of which python in terminal).

Any suggestions are welcome. Thank you.

4条回答
劳资没心,怎么记你
2楼-- · 2019-04-07 21:25

This is strange, but you can install Keras directly through Pycharm.

You can follow this steps:

  • Go to Settings -> Project -> Project Interpreter
  • Click on plus icon in the top-right corner
  • Search Keras and press on Install Package

Please let me know if this procedure solve your issue.

查看更多
Anthone
3楼-- · 2019-04-07 21:26

I do not know what happened, but the problem solved with the following steps.

  1. Uninstall old keras
  2. Re-install keras: pip install keras

Then I can import keras in pycharm.

NOTE: It is strange since I have keras installed but cannot find it in Project Interpreter's package list.

查看更多
Anthone
4楼-- · 2019-04-07 21:26

My solution:

if you ever have installed in python:

  • Go to File->Settings->Project->Project Interpreter
  • Click the gear-> Add..->System interpreter
  • Choose the python version that have installed keras
查看更多
ら.Afraid
5楼-- · 2019-04-07 21:36

To clearify Giordano's answer:

  1. You should have installed tensorflow or any other framework where keras can be used on top of.
  2. Create a virtualenv and set this as your project interpreter. This is a working solution for me: Installing tensorflow on Pycharm (Mac)
  3. Got to preferences -> Project: -> Project Interpreter
  4. Click on the plus sign on the bottom left corner
  5. Search Keras and install the package.
查看更多
登录 后发表回答