I activated my virtual environment in vs code. In the PowerShell where my environment was activated, I installed Flask successfully. Then I ran this code in my file main.py:
from flask import Flask
app = Flask(name)
@app.route(‘/’)
def hello_world():
return ‘Hello, World!’
if name == “__main”:
app.run()
But when I try to run the command ‘python .main.py’ in the PowerShell where my environment is activated, it displays:
(venv) PS C:UsersLenovoDesktopmyprj>
It doesn’t give me the link to my web.
I have checked the previous stack overflow question about it. The answers couldn’t solve my problem. I watched a video on it, but it didn’t work.
I also faced problems while trying to set up my virtual environment. So I setted up this way:
- pip install –user virtualenv
- python -m virtualenv venv
- Set-ExecutionPolicy RemoteSigned -Scope Process
- venvscriptsactivate
Khadeeja Abdul Ghaffar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.