Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python pip still looking for previous installation

After experiencing this brew issue with sqlite3, I did

brew rm sqlite python python3

then

brew install python python3

This installed python2.7.5 as the default interpreter and as brew installs pip along with python, I thought I would be able to

pip install virtualenv

to install virtualenv for the new python2.7.5. However, I'm getting

-bash: /usr/local/share/python/pip: /usr/local/Cellar/python/2.7.3/bin/python: bad interpreter: No such file or directory

How can I get around/fix this? Should I be creating a symlink between

/usr/local/share/python/pip --> /usr/local/Cellar/python/2.7.5/bin/pip-2.7
like image 732
puffin Avatar asked May 19 '13 10:05

puffin


People also ask

Why is pip install not working in Python?

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.

How do I uninstall old pip?

To use pip to uninstall a package locally in a virtual environment: Open a command or terminal window (depending on the operating system) cd into the project directory. pip uninstall <packagename>

How do I force a pip install?

To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .

Does pip automatically install latest version?

Pip is usually bundled with Python and updates automatically, but in you might want to manually upgrade and manage it. This is what we'll be teaching you today. This process should work whether you're using pip on Linux, Windows, or macOS.


2 Answers

It sounds like your /usr/local/share/python/pip is pointing to the wrong version of Python. Check the first line of that file, and if it looks like...

#!/usr/local/Cellar/python/2.7.3/bin/python

...then you'll need to change it to point to the correct version of Python.

like image 64
Aya Avatar answered Sep 22 '22 13:09

Aya


The python3 homebrew package installs pip as pip3. You can even install multiple versions of python 3, e.g. python 3.2 and 3.3 and each will get linked as pip-3.3 and pip-3.2.

like image 44
jrwren Avatar answered Sep 25 '22 13:09

jrwren