I haven't been able to find a question / answer that satisfied my needs, but I am sorry if this will be a duplicate question, if so, please let me know.

I am using Python (2.7) on a debian server and when I installed pip I experienced weird behaviour when I did an uninstall of and installed again from another package manager (guess apt uses the pypa.io release as well in the end).

What I Have Done

1. Downloading pip from pypa directly and installing with python
me:~$ curl -o get-pip.py https://bootstrap.pypa.io/pip/2.7/get-pip.py
me:~$ python get-pip.py
2. Uninstalling pip
me:~$ pip uninstall pip
3. Installing pip using apt
me:~$ sudo apt-get install python-pip

My Problem?

When I now run pip I get the following error:

me:~$ pip
bash: /home/local/me/.local/bin/pip: No such file or directory

My Question?

When I run the command:

me:~$ which -a pip

I get:


I can see there seems to be a path problem, but I fail to see how to fix it, could anyone point me to a solution and could this just be a priority problem in the $PATH variable?


1 Answer 1


This is 100% a priority problem in the PATH variable. Also keep in mind that you need to reload/restart your shell (terminal) if you edit the PATH, because shells keep a cache of the discovered locations of various programs, so just editing/reloading the PATH variable isn't enough. The program location cache has to be refreshed too.

Anyway this is all moot. I highly suggest that you install Pipenv instead. It's the official, recommended way to install PyPi software. It's kind of a drop-in replacement for pip, but with an infinitely better dependency manager, reproducible (hashed) installations, automatic internal use of virtualenv to separate your project dependencies per-project to avoid a clashes, and a much better config file (named Pipfile instead of requirements.txt).

It would solve all your issues 100%.

You could also install pyenv on the same machine, which will be detected by pipenv and will allow it to manage exactly which Python versions are used for each of your project folders. To create a new project in a folder and tell it to use a specific version of Python, you'd just do pipenv install --python=3.10 etc.

  • I've accepted your answer for my problem, it was a problem with the priority in the $PATH variable. I changed the order and voila! I will look into pipenv, not something we will use on this work server the problem arose, but for my own projects. Thanks for the answer and suggestion on pipenv :)
    – Mattias
    Feb 18 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.