Jesmin
Jesmin

Reputation: 51

How to install package using pip when you have 2 Python versions

I have 2 anaconda in my system: one with python 2.7 & and another with python 3.5.

My command prompt is showing python version as 2.7.

I need to install one package for Python 3.5 using pip only,not conda install. I installed it using pip. It's showing installed successfully, but I'm not able to import it in Anaconda with Python 3.5.

My python 2.7 path is given in path environmental variable. Can you suggest me how to install it using pip install for python 3.5?
I don't have python 3 installed in my system. I think I have anaconda 3.5 environment in my system. Please refer the screen shot. Also I can't able to install python 3.5 in my system enter image description here

Upvotes: 0

Views: 253

Answers (3)

iz_
iz_

Reputation: 16583

Assuming you mean that you have two conda environments, go to a Anaconda command prompt and activate the Python 3.5 environment. Then, if pip is not installed, do:

conda install pip

Then, you should be able to run

pip install <package>

to install in to Python 3.5 provided that you are in the Python 3.5 environment.

If you don't have a Python 3.5 environment yet, simply do

conda create --name py35 python=3.5

followed by

activate py35          (Windows)
source activate py35   (Linux or macOS)

Upvotes: 1

Ram
Ram

Reputation: 541

You can use:

pip install --install-option="--prefix=$PATH_PREFIX" <package_name>

or

pip install -t <direct directory> <package_name>

Upvotes: 0

Mayank Porwal
Mayank Porwal

Reputation: 34046

To install a package in specific version, try this:

A specific version of python:

$ python-3.5 -m pip install <pkg-name>

Upvotes: 2

Related Questions