Note: I'm new to Python and I've never really used external modules like the ones listed below so feel free to let me know if there's anything I could be doing better in order to get my program up and running.

I'm currently working with a python (2.7.x) program that requires the use of the SciPy stack. The previous developer of the program was using Anaconda in order to access all external modules. In my case, I need to be able to run the entire program with a single command. For example:

python myFile.py

Will execute myFile.py (which has the following imports):

from numpy import *
from pylab import *
import matplotlib.pyplot as plt

From what I understand, Anaconda is an IDE that requires you to execute code in a similar way to Visual Studios (i.e. a "Run" button). So my question is:

Is there a way for me to do this directly from the command line?

Note: The reason I'm specifying the use of Anaconda instead of just using the external modules themselves is because on the SciPy website there's constant mention that it's easiest to just use a scientific python distribution like Anaconda or Python(x,y). Ultimately, I'm okay with any solution that allows me to run my program with the above imports.

  • 1
    Not really, anaconda tries to make a Python that is independent of the Python installed on the OS. It uses the conda command to manage environments, e.g. conda env list. The environments are not that different from virtualenv and use a script called activate that need to be sourced, e.g. source activate <env>. But my experience with anaconda is pretty limited so I may be wrong about some parts.
    – grochmal
    Aug 3, 2016 at 20:32
  • just type the name of the program you want to run. e.g if you are inside the required environment and want to run program called spades. type spades and give the file directory and output name etc
    – user355034
    May 27, 2019 at 20:37

2 Answers 2

  1. Create required Anaconda environment conda create --name environmentName python=3 pandas numpy. Include all your dependencies at once while creating the environment.
  2. Switch to the environment with conda activate environmentName.
  3. Executing the python script python fileName.py. You don't have to specify the python version because the script is running inside the Anaconda environment. The version used will be whatever is specified in the environment (the script required python3 which has already been specified in Anaconda environment).

Thanks for the question and the answer regarding step 3 it didn't work when I ran python setup.py or python3 setup.py step 3 didn't work with me it worked when I ran

pip install . 

in the desired directory which have setup.py which you can download as zip from github for your package you want to instal I am using conda environment in Ubuntu (bioconda3)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .