A
A
Adolf452021-06-04 22:14:18
Python
Adolf45, 2021-06-04 22:14:18

How to create virtual environment in python in VS code?

Recently I started to master python, I am learning how to create a bot in a telegram using this guide https://habr.com/ru/post/495036/
60ba7b38c48b9962946734.jpeg
As I understand it, after the third line from the top, the same environment should be created and in the console it will also always be in the beginning the name ("venv" as in the screenshot), but it doesn't work out for me. I
thought that everything might be ok, I'm moving on. Flask is installed, everything is fine
Next comes this 60ba7b7328b5e472694691.jpeg
And I couldn't go any further, because when I type (venv)$ export FLASK_APP=app.py, an error occurs: export : The name "export" is not recognized as the name of a cmdlet, function, script file or running program. Check the spelling of the name
and the presence and correctness of the path, then try again.
string:1 character:1
+ export FLASK_APP=app.py +
~~~~~~
+ CategoryInfo : ObjectNotFound: (export:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

for some reason it doesn't work for you

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yupiter7575, 2021-06-04
@Adolf45

You can add an app.run() line at the end of the code and run the code like normal .py code.

S
soremix, 2021-06-04
@SoreMix

Judging by the error, you are executing the code in powershell on windows, while export is a command for Linux.
In Windows, the analogue will be SET.
In fact, I would start with something simple. Virtual environments, ngrok, webhooks. If you have just started learning, it is better to start with the basics of the language. Next, try to create a bot without a webhook, using some library, telebot will be easier . Next, you can already connect it with Flask.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question