使用pip为特定的python版本安装模块在Ubuntu 10.04上默认安装了Python 2.6,然后我安装了Python 2.7。我如何使用pip install安装Python 2.7的包。例如:pip install beautifulsoup4默认情况下,安装BeautifulSoup for Python 2.6当我做:import bs4在Python 2.6中它可以工作,但在Python 2.7中它说:No module named bs4
3 回答

慕容708150
TA贡献1831条经验 获得超4个赞
或者,因为pip
它本身是用python编写的,所以你可以用你想要安装包的python版本来调用它:
python2.7 /usr/bin/pip install foo
编辑:或者,根据llopis的评论:
python2.7 -m pip install foo

蝴蝶不菲
TA贡献1810条经验 获得超4个赞
您可以使用相应的python为特定的python版本执行 pip模块:
Python 2.6:
python2.6 -m pip install beautifulsoup4
Python 2.7
python2.7 -m pip install beautifulsoup4
添加回答
举报
0/150
提交
取消