Komodo isn't using the right Python


I am using a mac running Catalina 10.15.2. I just recently installed python 3.7.3 using pyenv. Along with it, I decided to get Komodo Edit 12. Everything is working, except for my installation of Pygame. I installed Pygame with the command
“pip3 install pygame”. It successfully installed to the directory; “./.pyenv/versions/3.7.3/lib/python3.7/site-packages”.

My issue is that Komodo doesn’t think that it is installed, my code is simply:


import pygame

The output is:
ModuleNotFoundError: No module named ‘pygame’

But only Komodo doesn’t know it’s installed. When I start pygame in the terminal by typing “python3” followed by “import pygame”. Everything seems to be working fine.
My question is; where is my terminal opening python3 from, so I can use that instead of “#!/usr/bin/python3”.

I know this isn’t at all an issue with Komodo, but I really don’t know where else to go for help, and after searching on Google I wasn’t able to find anything to help me. If someone can’t or won’t help me with this, could someone direct me to a different place to put this question? Thank you.


Fixed by changing: #!/usr/bin/env python3
To: #!/users/$(myaccountname)/.pyenv/versions/3.7.3/bin/python3


@Tristan_Davis, that could cause you issues if you evern share the code or try to run this on a different computer in a differently configured env. You should be able to set your prefs to use that the correct Python, Komodo menu > Preferences > Languages > Python3.

The main reason Komodo doesn’t know about that Python in your pyenv is because you likely didn’t start Komodo from the terminal where you pyenv session is active. You could close Komodo then start it from your terminal where the pyenv is active with the following command:
$ {Path to Komodo}/Content/MacOS/komodo
Komodo then loads with the correct environment and should be aware of everything.

  • Carey