close

How to use pip for pyenv?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to use pip for pyenv in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to use pip for pyenv?

  1. How to use pip for pyenv?

    When using pyenv, you should be able to set your 'local' version in the directory you are working in, and then pip will rely on this version.

  2. use pip for pyenv

    When using pyenv, you should be able to set your 'local' version in the directory you are working in, and then pip will rely on this version.

Method 1

When using pyenv, you should be able to set your ‘local’ version in the directory you are working in, and then pip will rely on this version.

So in your case:

pyenv local 2.7.14
pip install package-name

But I do think the main piece that is missing here is a ‘virtual environment’ to keep your Python packages independent per project (even if they share the same Python version). It is not necessary based on what you are asking, but it is a generally agreed upon best practice. See the Python docs here for more info.

Method 2

I am sharing my realtime experience,

my system is pointing default to python2.7 even though I installed python3.6 in my machine

But when I trying to download new packages for python3.6,But it is downloading with default python2.7

so I came across this pyenv,

I installed the pyenv

after installing

 $ pyenv install --list
 $ pyenv global

pointing to default system(python2.7)

installed python3.6

$ pyenv install 3.6.9

changed from python2.7 to python3.6

$ pyenv global 3.6.9

Here, we have to notice that by installing pyenv by default pip is installed.

using pip command I installed required package which for python3.6 without adding suffix number like pip3.

 $ pip install pyOpenSSL

suppose if you want installed the package related python2.7 then change then python environment

$ pyenv global 2.7.0

and you can install your required package using pip instead of using pip3

pip install package-name

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read