Are the two ways of calling ipython (ipython and ~/.local/bin/ipython) equivalent?
Short answer: no, they are not equivalent. Now lets see why:
Pip can install packages under a user's own home directory if you use it with the --user
option, like you did. When you do this, it installs the package to ~/.local
(note that this relative path gets expanded to something like /home/username/.local
), however you still have only one global Python interpreter at /usr/bin/python
. This makes the different libraries or modules that you install this way to only be accessible locally, which means that they aren't shared among users.
If you call any program with a relative or absolute path it will run whichever executable is located at the end of that path if it exists. In this case, the relative path ~/.local/bin/ipython
points to a local instance of IPython.
When you call an executable by just typing its name, like ipython
the PATH environment variable is used to determine what to run. So what actually runs will depend on its precedence in your PATH. This may or may not be the same executable as the one located at ~/.local/bin/ipython
.
Use the which command to check what executable will be launched if you only type the name of a command: which ipython
. It will give you the path to it.
Additionally, if you are already installing packages locally rather than system wide, I'd suggest you use virtual environments, it will make your life easier (most of the time), give virtualenv
or venv
a try.