python link redis pycharm import redis prompt No module named redis!

code show as below:

import redis

r = redis.Redis(host='127.0.0.1', port=6379)
r.set('hello_j', 'hel_2')

print(r.get('hello_j'))

my machine ubuntu

But when I played with it for the first time, I found 

pycharm import redis prompts No module named redis!

One is to install https://github.com/andymccurdy/redis-py directly 

But this method does not know how to configure pycharm


The second method above is suitable for novices:

In pycharm, click file-setting-projcet interpreter-click the plus sign on the right, enter redis on the pop-up page and click install.


Related Posts