0

I'm unable to import modules in pycharm, however i am easily able to do it via the cmd (after i've typed) python and via the python console in Pycharm as well. I am using python 2.7 and python.exe is in my PATH.

In Pycharm when i go into setting and look at the interpreter i can clearly see the module (pytesseract)

I am using pycharm 2018.3.2

Here are the images.

https://i.stack.imgur.com/czTUC.jpg

  • Seems you are using `venv`. I'm not too familiar, but did you `activate` your `venv` environment containing the `pytesseract` module? – r.ook Dec 27 '18 at 19:16
  • i didn't even know i was using a venv, i was under the influence i was using my normal environment. How can i deactivate venv? –  Dec 27 '18 at 19:25
  • Again I'm not too familiar with `venv`, but here's the documentation that might help you: https://docs.python.org/3/library/venv.html – r.ook Dec 27 '18 at 19:32

1 Answers1

1

There are 2 ways that PyCharm will reference a python interpreter, and you have to make sure they are both configured correctly. They perform different functions, and do so independently of one another.

The first place is in 'File=>Settings=>Project:x=>Project Interpreter'. PyCharm will use the interpreter (ie: python environment) you select here to analyze your code within the IDE.

Project Interpreter

Project Interpreters

The second place is in Run/Debug Configurations. This allows you to specify multiple configurations for running your project. Each configuration can specify a different python interpreter for running / debugging your code. Each configuration you create will add a corresponding option to the dropdown in the main interface.

Run / Debug Configurations

Creating & Editing Run Debug Configurations

Timothy Jannace
  • 1,401
  • 12
  • 18
  • Thank you for your detailed answer. This fixed my issue! –  Jan 02 '19 at 09:46
  • @workerbee Glad it helped! I love seeing people use PyCharm, it's a pretty awesome IDE! Here's a handy trick PyCharm offers that I wish I knew about on day 1: https://www.jetbrains.com/help/pycharm/type-hinting-in-product.html#adding-type-hints – Timothy Jannace Jan 02 '19 at 15:42
  • 1
    Totally agree, before pycharm i was running pdb to debug my code and that was a pain! –  Jan 03 '19 at 13:39
  • I have never seen pdb before. It looks a bit fun, but debugging with that would definitely be a lot of work compared to an IDE! – Timothy Jannace Jan 03 '19 at 19:31