python - Cannot install Flask with pip on MacOS - Stack Overflow
python - Installing python3-pip / flask on macOs Mojave 10.14.5 - Stack Overflow
python - Import flask not working on my macbook pro m1 chip - Stack Overflow
How tf do you start a flask project
Videos
ยป pip install Flask
The environment you are using hasn't installed the package you want to import caused the first problem. The pip of python 2.7 installs the flask failed, cause the second problem.
You should select the right environment. You can follow these steps:
Under your project runs:
python3 -m venv .venvto create a new virtual environment.Select the environment you have just created: Ctrl+Shift+P ==>
Python: Select Interpreterto choose the environment.Take Ctrl+Shift+P ==>
Terminal: Create New Integrated Terminal(Ctrl+Shift+`), opens a command prompt for your selected interpreter. You should find (.venv) in the terminal, this means you had selected the right environment.Check which pip you are using: in the terminal, types:
pip --version, it will determine which environment your package will be installed to.Install the package you need.
It is all because you haven't installed the module. It wouldn't really run without installing.
So you would have to install it. The issue here is that I don't use MAC so I can't explain but I have found a video that would explain it to you.
Link: https://www.youtube.com/watch?v=yBdZZGPpYxg
Watch the video. In the video they explain how to install requests module. You can simply write flask instead to requests while they tell you how to install.
Hope this helps. If still this doesn't make sense, please ask me in the comments. :)
Thank You! :D
Aite,
So i'm coming over from nodejs. And i cannot understand how to start a flask project.
I've downloaded python, and its showing in my file system but It doesn't seem to do anything. If I open my command prompt and check for the version with "python --version" it returns nothing. If I simply type "python" on the command prompt, it opens the Microsoft store. So dunno what that's all about.
Anyway I just want to start a flask project and start learning. With nodejs i'd just open vscode, run npm init and away I go...Can someone describe in plain English how to start a flask app to get me setup in vscode.
I've just uninstalled python so i'm starting from zero.
Thanks.
Help with Flask on a mac?? I run this code:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == "__main__":
app.run(debug=True)I see this in my terminal: (py3Env) michaelsduwors@Michaels-MacBook-Pro hello_flask % pip list Package Version ------------ ------- click 8.0.4
Flask 2.0.3
itsdangerous 2.1.1
Jinja2 3.0.3
MarkupSafe 2.1.1
pip 22.0.4
setuptools 57.0.0
Werkzeug 2.0.3
(py3Env) michaelsduwors@Michaels-MacBook-Pro hello_flask % python hello.py
* Serving Flask app 'hello' (lazy loading)
* Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Debug mode: on * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN: 128-051-052
Terminal appears to be working as it should, but I see this when I go to localhost:5000/ in my browser:"Access to localhost was denied. You don't have authorization to view this page." I had no problem accessing localhost:8000 when I used Django before.
Edit: I later learned that the new Mac OS uses port 5000 for the airplay receiver. So I use
app.run(debug=true,port=5001)
And everything works fine.