'Running Spyder '5' on Debian 11
Why does calling spyder as 'root' on cli execute the spyder '5' version software, while doing the same as a normal 'user' executes spyder '4'?
How do I make it always calls in the version '5' from a normal 'user' access level?
Solution 1:[1]
Run the command which spyder when logged in as root and when logged in as normal user.
$ which spyder
/usr/bin/which: no spyder in (/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin)
What shell are you using?
Run echo $SHELL to see.
You are probably using bash.
$ echo $SHELL
/bin/bash
bash and other shells find commands(executables) usually by looking through the PATH environment variable. Run echo $PATH to see what your PATH is set to as root and as normal user.
$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin
Compare the PATH that is set for root user and other user.
Hopefully this answers the first question.
(p.s. please post a comment or edit question and include the PATH you see for root and other user as well as output of which spyder on both)
For the second question:
You can add another dir at the start of PATH on command-line, e.g.
$ export PATH=/path/to/other/spyder:$PATH
Adding a path in front of the PATH variable will make bash search there first for a matching command name.
You can add a line like that to your .bash_profile or .profile in your $HOME directory OR to more system-wide /etc/profile or other files.
You could also have an environment setup script that you use when switching between different projects or tasks. e.g. script like ~/bin/setup_env_project1.sh This would be safer than changing PATH for root especially which could have un-intended bad consequences.
For some fun and a short lesson in the dangers of changing your path try this:
$ export PATH=
Now try some usual commands. Like ls, which ls, cd. Commands like cd and which which are "built into" the bash shell will work ok. However commands like ls and find and grep and spyder now cannot be found. Just logout and log back in again to get your $PATH back.
It is a simple thing to add something at start or at end of your $PATH. It's one of the fundamental things in the shell. There is more info all over stackoverflow and the internet in general e.g.
https://unix.stackexchange.com/questions/26047/how-to-correctly-add-a-path-to-path
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
