Bash script to activate virtual environments for python

preview_player
Показать описание
Writing scripts helps in reducing repetitive work by putting all those tasks into a script and run the script every time it is required.
Here's a script to activate virtual environment for python and starting the Jupyter server for creating and editing python codes and running them on the go.
Commands used:
touch (to create a file)
ls -l (to list the contents of a directory)
vim (text editor) - use 'i' to enter insert mode and "esc" to exit, ":wq" to save
. [script_name].sh to run a script (you can also use "bash [script_name].sh")

Learn how to write and call functions in bash,
activate virtual environments using scripts and run jupyter server.
#Bash #Linux #Scripting #Automation #python
Рекомендации по теме
Комментарии
Автор

Mate, I need to write a script to activate the virtual environment. I usually keep the project directory that I'm working on in the desktop, but once I finish I move the directory to other place, and turns out that when I do that, the virtual environment stops working... Then I have to create another one and install all the dependencies... I want to keep all the virtual environments of my projects in one place different than the project directory, but I need a script to activate the virtual environment that belongs to that project. HOW CAN I DO THAT??

giovanniosorio
Автор

Hi! I try to write bash script to restart my telegram bot. I write
"sh
/usr/bin/python3
and have error, that says, that virtual enviroment not activate.
I tried to activate virtualenv how you show on thos video, but have such trouble.
Is it big different between activating virtual enviroment using Jupiter server or without it?

enmgwxl
Автор

Bash script for creating virtual env please

FahadAli-otkn