Friday, May 3, 2024
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 8928  / 1 Year ago, tue, january 24, 2023, 8:37:26

I am using sage a math library in python. After downloading its package, I usually have to go to the directory where I extracted it and then run the the script using



sudo ./sage


from terminal. How can I add sage to the list of installed applications, that I will be able to run the script by typing sage command from any directory in terminal?


More From » command-line

 Answers
0

You'll need to add that scripts directory to your PATH variable. This can become tedious if you download a lot of self-contained executables. My recommendation would be to create a bin folder in your home folder and place all your self-contained executable files in there.



Most recent versions of Ubuntu already have their PATH setup to read from $HOME/bin so it'll work after a restart of the terminal or after you type source ~/.profile. Once that's completed you should be able to just enter sage in to the terminal.



If you wanted to add another directory, other than ~/bin, you can open the .profile file in your home directory and add the following line to the bottom:



PATH="/path/to/folder:$PATH"


Replacing /path/to/folder with the absolute path to the directory you wish to add. That will prepend the directory of your choice to your PATH environment and it'll take effect once you enter source ~/.profile (or restart the terminal).


[#44218] Tuesday, January 24, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ligenvirt

Total Points: 238
Total Questions: 98
Total Answers: 100

Location: Senegal
Member since Fri, Aug 21, 2020
4 Years ago
ligenvirt questions
Tue, Aug 17, 21, 02:28, 3 Years ago
Thu, Sep 23, 21, 17:55, 3 Years ago
Mon, Oct 18, 21, 03:34, 3 Years ago
;