Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup a pipenv Python 3.6 project if OS Python version is 3.5?

Tags:

python

pipenv

My Ubuntu 16.04.03 is installed with Python 3.5.2. How do I setup pipenv to use Python 3.6 when my system does not have python 3.6?

$ pipenv --python 3.6
Warning: Python 3.6 was not found on your system…
You can specify specific versions of Python with:
  $ pipenv --python path/to/python
like image 767
Sun Bear Avatar asked Apr 12 '18 10:04

Sun Bear


People also ask

How do I make a Pipenv a specific version of Python?

When setting up your pipenv you can specify the version of Python by using: pipenv --python 3.6 , to use Python3. 6. to the specific version of Python you want. If you did all of this and are still having trouble with accessing the correct version of Python from within pipenv shell then you might want to check your .

Which Python version is Pipenv using?

pipenv install --python 3.8.

Does Pipenv install Python?

☤ Installing PipenvWhile pip can install Python packages, Pipenv is recommended as it's a higher-level tool that simplifies dependency management for common use cases.

What version of Python is current?

Python 3.9. 8, documentation released on 05 November 2021.


Video Answer


3 Answers

Either manually write the version you need in your Pipfile:

[requires]
python_version = "3.6"

Or install it on your system. But I guess you will need the version to be installed if you plan to actually run pipenv install.

I would suggest to use pyenv: https://github.com/pyenv/pyenv.

Follow the installation instructions, then installing Python 3.6 is just a matter of

pyenv install 3.6.3

Then you can set the order of preference with

pyenv global system 3.6.3

Besides, if pyenv is available, pipenv will automatically use it to install the required version. From pipenv README:

Automatically install required Pythons, if pyenv is available.

like image 89
pawamoy Avatar answered Oct 19 '22 11:10

pawamoy


On MacOS, I have also used pyenv to manage python versions, similar to @pawamoy's suggestion.

After installation I executed pipenv shell with the --python option pointing to the directory of the specific pyenv version. This will automatically generate a Pipfile with python_version = "3.6".

⇒  pipenv --python /Users/<Your User>/.pyenv/versions/3.6.3/bin/python3.6 shell
like image 13
andrei13 Avatar answered Oct 19 '22 11:10

andrei13


Install 'pyenv' package by using brew install pyenv (if you don't have it).

Install python 3.6 using pyenv install 3.6

Export new installed python version to PATH

export PATH=${PYENV_PYTHON_VERSIONS_HOME}/3.6/bin

Now in 'Piplock' specify the same version.

[requires] python_version = "3.6"

Finally, run pipenv install --dev.

like image 7
Adnan Murtaza Avatar answered Oct 19 '22 10:10

Adnan Murtaza