Pip install for both pythons

2019-02-20 13:58发布

I'm new to pip and I've use it to install some module on my system, say pyglet, successfully. I have 2 versions of python, 2.7 and 3. When I use python3, pyglet works fine, but in python2, it tells me module pyglet not found.

How can I pip install to both of python2 and python3?

Thanks.

标签: python pip
2条回答
Lonely孤独者°
2楼-- · 2019-02-20 14:46

pip will only install to one python environment.

It sounds like pip has installed to your python3 environment and you need to install again to python2.

The pip script knows which python it is to installs for by the python in the #! line

To get a pip for your python 2 either there is already a pip2* script on your machine or you will need to install pip for python2

See this question for details about installing pip

查看更多
beautiful°
3楼-- · 2019-02-20 14:49

I think what you need is virtualenv https://pypi.python.org/pypi/virtualenv . virtualenv is a tool to create isolated Python environments

查看更多
登录 后发表回答