Skip to content
Advertisement

How to run a Python module from Linux console?

I am a beginner in Linux and I am trying to do something very basic (yet it does not seem to work).

I have installed a python3 package. I wish to run this Python package on a specific folder from my linux machine. The idea is that this package should restructure all my files in a specific format (this is the link to the package https://github.com/SIMEXP/Data2Bids ).

In the demo of the tutorial, it is mentioned that once I install the package:

pip3 install data2bids

I should just use cd on my desired folder that needs restructuring and then simply run data2bids.

After doing so, I received a command not found error.

I have tried to run the package using the python data2bids command (thinking that maybe I should mention it is a python package. I have tried to use the full path of where the package was installed in the command, yet it did not work. I even tried to install the package in the same folder as my directory that needs restructuring, with no results.

I believe that this is a very basic problem, and the solution may be very simple. Within a linux machine, how does one exactly run a python module in a specific folder?

Advertisement

Answer

I am also a rookie in Linux, here’s what i can think of.

First, the input is:

A directory containing some files in any extension, with names containing at minimum the information of modality and patient number. A .JSON configuration file explaining how the filenames should be read.

I assume you ran the command without the configuration file.

Second, Linux has built-in python whose version is 2.x, try to type python in command line and print python version, if it’s 3.x, try to query pip installed list to see if the package was installed successfully, if not, see if the installed python 3.x directory is contained in PATH.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement