Python flask-cors ImportError: No module named 'flask-cors' Raspberry pi

Nelson Candia picture Nelson Candia · Feb 9, 2018 · Viewed 48.9k times · Source

I'm following the flask-cors tutorial from the documentation here: https://pypi.python.org/pypi/Flask-Cors

but when i installed it on my raspberry pi and run my python app i'm getting this error

Traceback (most recent call last): File "app.py", line 3, in <module> from flask_cors import CORS, cross_origin ImportError: No module named 'flask_cors'

here is my python script:

from flask import Flask
from Main import main
from flask_cors import CORS, cross_origin    
app = Flask(__name__)
CORS(app)
main = main() 

@app.route('/turn' ,methods=['GET', 'OPTIONS'])
def index():
  return main.turn()

if __name__ == '__main__': 
  app.run(debug=True, host='0.0.0.0')

Answer

Moureen Caroline picture Moureen Caroline · Jul 7, 2019

It worked for me finally

pip install -U flask-cors