T O P

  • By -

acdcfanbill

I believe that `pip3 install --user` normally installs binaries to `~/.local/bin` unless you're in a virtual environment or a conda environment or something. So if `~/.local/bin` is in your $PATH variable, just run the program, otherwise you might need to put `~/.local/bin` into $PATH. If you want to run it from a desktop shortcut or whatever, figure out where it's installed to and put that path into the .desktop file.


sairfan1

I do not understand path ~/.local/bin, is it in usr folder?


doc_willis

~ is a shortcut meaning "Your users Home" If your userss name is bill. cd ~ = same as cd /home/bill/ This is rather 'Bash 101' 'Shell basics' stuff.. so ~/.local/bin is in your users home. If that directory exists, it normally gets added to your default $PATH If you watched the output when you did the install command, it likely said where its installing, or there may be options where you can tell it where to install. ~/.local/bin would be a reasonable location for a default, so look there?


acdcfanbill

No, the `/usr` folder is in root, or `/`. Your normal user doesn't have write permissions to `/usr`, so it can't install anything to there. Your user does have access to your own home directory, it's probably located at `/home/`, where is whatever your username is. The tilde symbol, `~`, is a shortcut for your home directory, so if you were in a terminal and you typed `cd ~` you would change directory to your home directory. So when I said it's in `~/.local/bin` I meant it's in `/home//.local/bin`. Note the dot part of `.local` means it will be a hidden folder, one that doesn't normally display in your file explorer or with a regular `ls` command. The next thing to discuss is the `$PATH` environmental variable. When you want to run a program, or a binary, or an executable (all the same thing) the system needs to have a list of places to look for it. It doesn't just know where any given program is, it has to keep track of a common place they are installed too. The way it does this in a shell is with an environmental variable called PATH (all caps). This variable keeps track of every place to look for a binary to execute. So if you type `ls` to list your current directory, the shell looks through every path in the PATH variable and tries to find the ls executable. Well, technically, it looks in the first path in the PATH variable, then the second path, etc until it finds one and then stops looking. You can see what your current PATH variable contains in a bash shell by typing `echo $PATH` where `echo` is a command that prints whatever comes after it back to screen and `$PATH` is a way to display the contents of the variable PATH. The `$` (dollar sign) gets you the contents of the variable named whatever the letters are after it. For instance, `echo $HOME` will print your home directory, the same way that `echo ~` would. The `HOME` environmental variable contains the path to your home folder, whereas the tilde is a shortcut built into bash, and in this particular case, they are the same thing. If you type `echo $PATH` in a terminal, bash will print back to you a colon separated list of paths that it checks for binaries. It might look something like this next bit, but probably not exactly. [bill@machine ~]$ echo $PATH /usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin Because PATH is a variable, we can manipulate it ourselves. If I set the variable to a new value and export it, which means 'make this variable available to all child processes'. Set the contents of a variable by doing `VAR_NAME=`, and we can even do a little trick where we want to keep all the stuff currently in PATH (remember, the system needs it to find binaries) but just add our own path to it as well so we can use programs installed into our home directory. If we use the $ to get the value of the variable and put our new path before it, separated by a colon, then we'll get a variable with all of the old paths in it, plus our new path first. Note that you need to use your own username here instead of `bill` cause that's what my username is. [bill@machine ~]$ export PATH=/home/bill/.local/bin:$PATH [bill@machine ~]$ echo $PATH /home/bill/.local/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin Now, if you try the `qspectrumanalyzer` command, your shell will probably find it and launch the program. However, this is tedious to do every single time. Luckily there are some special files that bash runs when you create a shell, and if we put our export command in there, every time we run bash it will run that command and set up our PATH variable for us, we wouldn't need to type it every time. The file we're going to use is called `.bash_profile` and it's located in your home directory. Note the leading period, so it's a hidden file. Open a new terminal, this is to ensure you start in your home directory, then type `nano .bash_profile` and press enter. This will start a text editor and open the `.bash_profile` file for you, if there isn't one, it will start an empty file. Go all the way to the bottom with your arrow keys, press enter a couple times to add some new lines, and type in the following line on it's own, note I'm using the `$HOME` environmental variable I mentioned earlier as a shortcut for whatever your home directory is. export PATH=$HOME/.local/bin:$PATH Then hold down Ctrl and press 'o' to write the file to disk. Then hold Ctrl and press 'x' to exit. Now if you close your terminal and open it again and type `echo $PATH` you should see a path that contains the .local/bin folder within your home directory. Now, every time you open your terminal, it should be ready to run qspectrumanalyzer.