I'm a newbie to python and just trying to get my head wrapped around how to get things to run/work in python across different environments. What I mean in this context in regards to environment is this. I'm learning python on my MacBook pro - Catalina 10.15.5. I've installed python using brew install
. I use pyenv
to control versions. Through iTerm I would create virtual environments using virtualenv
and pip install
to install modules, etc.
I'm also using Visual Studio Code and PyCharm to learn and understand these tools as well.
I've reviewed and tried a number of python tutorials in my journey to learning python.
With that said, why is it when using iTerm, if I do a pip install <module>
, the module shows being installed with no errors, but when running the application (FLASK_APP=app.py flask run)
, i'll get this message:
Traceback (most recent call last):
File "/Users/pynoob/.pyenv/versions/3.8.0/lib/python3.8/site-packages/flask/cli.py", line 240, in locate_app
__import__(module_name)
File "/Users/pynoob/Desktop/MyWork/Learn/LearningPython/OktaTutorial/app.py", line 2, in <module>
from flask_oidc import OpenIDConnect
ModuleNotFoundError: No module named 'flask_oidc'
However, when I run these same in Visual Studio Code, in the terminal, it works. How? What am I misunderstanding fundamentally when using modules? Does it have to do with iTerm vs. Visual Studio Code?
Here's the snippet of python code:
from flask import Flask, render_template, g, redirect, url_for
from flask_oidc import OpenIDConnect
from okta import UsersClient