0

I am using MacOS and trying HelloWorld for Flask.

Created a Virtual Environment for Flask and sourced it:

source ./venv_flask/bin/activate

Installed flask with pip install flask and checked:
~/python/venv_flask » pip freeze

click==6.6
Flask==0.11.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
python-dateutil==2.5.3
requests==2.10.0
six==1.10.0
Werkzeug==0.11.10

Created very simple (1 line) python file:
~/python/venv_flask » cat hello.py

from flask import Flask

When try to run it - error show up:
~/python/venv_flask » python hello.py

Traceback (most recent call last):
  File "hello.py", line 1, in <module>
    from flask import Flask
  File "/Users/user1/python/venv_flask/flask.py", line 1, in <module>
    from flask import Flask, render_template, session, redirect, url_for
ImportError: cannot import name Flask

How to properly install/run python code with Fask application?

Joe
  • 11,983
  • 31
  • 109
  • 183

0 Answers0