aahnik
aahnik

Reputation: 1861

How to Install a python package via pip in site-packages of specific python installation?

When I run pip install fasteners, it shows

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: fasteners in ./.local/lib/python3.6/site-packages (0.15)
Requirement already satisfied: six in ./.local/lib/python3.6/site-packages (from fasteners) (1.15.0)
Requirement already satisfied: monotonic>=0.1 in ./.local/lib/python3.6/site-packages (from fasteners) (1.5)

The package is installed in ./.local/lib/python3.6/site-packages.

But I want to install it in /usr/bin/python2/site-packages ,

because duplicity uses python2 . And on running duplicity --version i get could not import fasteners error

Upvotes: 0

Views: 4442

Answers (2)

EduardoSaverin
EduardoSaverin

Reputation: 545

As shared by you in comment section of @Nathan Mills's answer you are getting SSL error. I think you are missing some of the libs. Try by installing below libraries and try again with the command you were using.

sudo apt-get install build-essential checkinstall 
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Then :

sudo python2.7 -m pip install fasteners

Try :

sudo python2.7 -m pip install --index-url=http://pypi.python.org/simple/ fasteners

Upvotes: 1

Nathan Mills
Nathan Mills

Reputation: 2279

Try the following command to install fasteners for Python 2.7:

sudo python2.7 -m pip install fasteners

if you get No module named pip error, try:

sudo python2.7 -m ensurepip --default-pip

then try installing fasteners again.

Upvotes: 1

Related Questions