hl79-james
hl79-james

Reputation: 131

My pipenv didn't work correctly

I have a vagant box ubuntu/xenial64-20180105 and there is python2.7.12 python3.5.2 defaultly, when I init(vagrant ssh),I use pyenv to install python3.6.4 and set python3.6.4 to my default env

pyenv install 3.6.4
pyenv global 3.6.4

I want use pipenv to manager to devel env so pip install --user pipenv

cd mydevel

pipenv --three

but some error happend lik this: enter image description here

the error message said pipenv can't find python interapter but when i run python it works? I think i need some help, thanks!

Upvotes: 0

Views: 552

Answers (1)

ThisIsFlorianK
ThisIsFlorianK

Reputation: 2331

You're not the only one with this problem. It is in their FAQ: https://pipenv.readthedocs.io/en/latest/diagnose/#pipenv-does-not-respect-pyenvs-global-and-local-python-versions

In short: Pipenv by default will not look at the pyenv python version. It'll use the version defined in the PIPENV_DEFAULT_PYTHON_VERSION env var.

To make Pipenv respect the version set by pyenv, there are 3 way of doing that. You can either:

  • Update your Pipfile with the correct version: [requires] python_version = "3.6.4"

  • Manually specify the exact python with the --python option: pipenv --python 3.6.4

  • Set pipenv to always use the pyenv python version, regardless of what's in the Pipfile. To do that, set the PIPENV_PYTHON enviroment var to $PYENV_ROOT/shims/python

Upvotes: 1

Related Questions