Installing to pyenv with pip

How can I install a package to a pyenv environment?

I run:

pyenv local 3.8.2

Then I run:

pip install xlib

But I get the following:

Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: xlib in ./.local/lib/python3.9/site-packages (0.21)
Requirement already satisfied: six>=1.10.0 in /usr/lib/python3.9/site-packages (from xlib) (1.16.0)

It should work, I have just tested it. How did you install pyenv? What is your PATH?

Can you check that which python returns the shim?

Found a workaround. I can install the package from PyCharm (Interpreter Settings → click + → find package → click Install).

Sorry to waste your time.

EDIT Did you mean running which python after pyenv local 3.8.2? Here’s the output:


I think pyenv came preinstalled, either that or I used pamac.

you not use pyenv (which return /usr/bin)
one good doc

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.