Pycharm without redis module

I installed python, Django and Redis. In Vim, I use "import redis" in the order when I use the pycharm IDE for coding, I write "import redis", the pycharm hint is "no module named redis", why? What should I do?

+4
source share
3 answers

According to my understanding, pycharm will say β€œNo module named redis” if you did not configure the python interpreter in pycharm or if there is no such module that you are trying to use installed in the python interpreter that you are currently using for PyCharm.

To add a python interpreter to pycharm, go to File -> Preferences -> Python Interpreter

enter image description here

+9
source

Ansuman tip gave me part of the way, but import redis was still blushing. I had the interpreter selected, but it turned out that I did not have pip installed and I did not have the redis package redis .

To get them, go to File > Settings > Python Interpreter (or PyCharm > Preferences > Python Interpreter on Mac) and select Configure Interpreters . Below it is suggested to install pip (sorry, not a screenshot). Do this. After installing pip install the redis module by selecting Install .

In the new window, find redis . Select redis (you may have to scroll down, it didn’t appear to me), then select Install Package .

Installing redis from available packages on PyCharm

Obviously this should work for all packages, not just redis .

+5
source

It is very simple. Rename your program file from "redis.py" to another name. (see redis_test.py, etc.).

0
source

Source: https://habr.com/ru/post/1489423/


All Articles