Karudoso
Karudoso

Reputation: 137

How to install/uninstall with pip to specific python folder?

I have a specific python2.7 folder where I would like to install packages using pip. The default python install is python 2.6

I managed to install numpy with <python2.7Folder>/pip -t ... numpy. The problem is that it compiled using the default python 2.6 libs and not it does not work . When I try to run numpy from python 2.7 I get this : undefined symbol: _PyUnicodeUCS4_IsWhitespace ... expectable.

So I try to uninstall this, but can't do it as it tried to uninstall it from the default python install.

File "/usr/local/lib/python2.6/dist-packages/pip-1.1-py2.6.egg/pip/req.py", line 410, in uninstall
    raise UninstallationError("Cannot uninstall requirement %s, not installed" % (self.name,))

The questions are:

Upvotes: 0

Views: 3918

Answers (2)

user1115370
user1115370

Reputation: 1

it is better if you create virtulenv and do everything there.

for example if you want to install numpy for python 2.6 you should do something like this


$easy_install-2.6 virtualenv

$virtualenv-2.6 python26

$source python26/bin/activate

$easy_install numpy or $ pip install numpy


Upvotes: 0

lbolla
lbolla

Reputation: 5411

To install libraries under Python2.7 you need the "2.7" version of pip. In other words, pip must be using python2.7 itself.

You can chech which python version pip is using with this:

$ head -1 `which pip`
#!/home/lbolla/.virtualenvs/work/bin/python2

Anyway, I strongly recommend you to use virtualenv, so you'll be able to create a new virtual environment every time you want and you'll not pollute python's system directories with packages.

Finally, you should be able to uninstall packages installed with pip using: pip uninstall <package>.

Upvotes: 1

Related Questions