Predictive Hacks

How to Run Python Shell Scripts from a Conda Environment

Suppose that you want to run a Python script or command via a Shell script (.sh) using a specific conda environment. Let’s see how we can do it. First of all, you need to find the path of your conda environment which can be retrieved by running the command:

conda env list

Assume that our conda environment is the ‘gpipis‘ and the path is the “/home/ds/.conda/envs/gpipis“. Finally, let’s assume that our python script is the ““. Let’s see how we can run the shell script asking to run the python script from the “gpipis” conda environment.

You will need to specify the whole path of your shell script. So, the “” can be:

/home/ds/.conda/envs/gpipis/bin/python /script_path/

And you can run it as:


Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore


Image Captioning with HuggingFace

Image captioning with AI is a fascinating application of artificial intelligence (AI) that involves generating textual descriptions for images automatically.


Intro to Chatbots with HuggingFace

In this tutorial, we will show you how to use the Transformers library from HuggingFace to build chatbot pipelines. Let’s