Pipenv is not used to install Python versions. You install Python separately and then use Pipenv to create and manage virtual environments, using pipenv install <package>
to install Python packages.
I think what you are trying to do is to create a virtual environment that uses your Python 3.7.9 version. To do that the correct way of specifying the Python version is to pass it as a --python=</path/to/python>
option. For example, for pipenv shell
:
~$ pipenv shell --help
Usage: pipenv shell [OPTIONS] [SHELL_ARGS]...
Spawns a shell within the virtualenv.
Options:
...
--python TEXT Specify which version of Python virtualenv should use.
The same option is available to pipenv install
. So if you have "python3 points to /Users/Micky/opt/anaconda3/bin/python":
~$ pipenv shell --python=/Users/Micky/opt/anaconda3/bin/python
Note that you have to pass the --python
option only when creating the virtual environment. Once it's created, it will "remember" it in the Pipfile to use that version.
temp$ pipenv shell --python=/usr/local/opt/python@3.7/bin/python3
...
✔ Successfully created virtual environment!
...
Creating a Pipfile for this project...
Launching subshell in virtual environment...
...
(temp) temp$ python -V
Python 3.7.9
Once your virtual environment, you use pipenv install <package>
to install Python packages (not Python itself):
(temp) temp$ pipenv install somepackage
(temp) temp$ pipenv install somepackage==1.0.0
I recommend reading the Basic Usage of Pipenv docs.