如何在特定python安装的站点包中通过pip安装python包? [英] How to Install a python package via pip in site-packages of specific python installation?

查看:275
本文介绍了如何在特定python安装的站点包中通过pip安装python包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行pip install fasteners时,它会显示

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)

该软件包安装在 ./.local/lib/python3.6/site-packages 中.

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

但是我想将其安装在/usr/bin/python2/site-packages中,

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

因为duplicity使用python2.在运行duplicity --version时出现could not import fasteners错误

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

推荐答案

正如您在@Nathan Mills答案的注释部分中所共享的,您正在获取SSL错误.我认为您缺少某些库.请尝试通过安装下面的库,然后使用您使用的命令再试一次.

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

然后:

sudo python2.7 -m pip install fasteners

尝试:

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

这篇关于如何在特定python安装的站点包中通过pip安装python包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆