如何在由Python 3.6安装的Python 2.7中安装模块? [英] How to install modules in Python 2.7 insted of Python 3.6?
问题描述
我的笔记本电脑上有两个Python版本. Python 2.7和Python 3.6.如果安装模块,则仅在Python 3.6中安装.
I have two versions of Python in my laptop. Python 2.7 and Python 3.6. If install a module this is installed only in Python 3.6.
我想通过pip在Python 2.7中安装模块,但是我不知道该怎么做.
I would like to install modules in Python 2.7 through pip but I don't know how to do it.
我现在想在Ubuntu 17.04中为Python 2.7安装GDAL和Fiona.
I want to install right now GDAL and Fiona for Python 2.7 in Ubuntu 17.04.
推荐答案
如果系统上已正确安装Python 2.7,则应具有python2
和/或python2.7
命令,并且可以运行以下命令:
If Python 2.7 is well installed on your system, you should have python2
and/or python2.7
commands and you could run the following:
python2.7 -m pip install <your-packages>
要确保您运行的是正确的python版本,可以使用python2.7 --version
To make sure you are running the correct python version, you can use python2.7 --version
这篇关于如何在由Python 3.6安装的Python 2.7中安装模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!