When trying to create a Python 3.10 environment with pipenv install
% pipenv install
...
...
Traceback (most recent call last):
File "/usr/local/bin/pipenv", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pipenv/vendor/click/decorators.py", line 73, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pipenv/vendor/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pipenv/vendor/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/pipenv/cli/command.py", line 233, in install
retcode = do_install(
File "/usr/local/lib/python3.9/site-packages/pipenv/core.py", line 1920, in do_install
ensure_project(
File "/usr/local/lib/python3.9/site-packages/pipenv/core.py", line 585, in ensure_project
path_to_python = which("python") or which("py")
File "/usr/local/lib/python3.9/site-packages/pipenv/core.py", line 97, in which
raise RuntimeError("location not created nor specified")
RuntimeError: location not created nor specified
in case it happens.
If your PC has multiple Python environments, pip and pipenv are installed for each environment.
To check which version of pip is running with the simple pip command,
% cat $(which pip)
and check the first line of the shebang.
% cat $(which pip)
#!/usr/local/opt/python@3.9/bin/python3.9
# -*- coding: utf-8 -*-
import re
import sys
...
% cat $(which pipenv)
#!/usr/local/opt/python@3.9/bin/python3.9
# -*- coding: utf-8 -*-
import re
import sys
...
This time, the error occurred while trying to create a Python 3.10 venv with pipenv in the Python 3.9 environment.
To run pip or pipenv in a specified Python environment, use the -m option.
This time, since I wanted to run pipenv in the Python 3.10 environment when pipenv is typed, I installed pipenv in Python 3.10.
% python3.10 -m pip install pipenv
After installation
% cat $(which pipenv)
#!/usr/local/opt/python@3.10/bin/python3.10
# -*- coding: utf-8 -*-
import re
import sys
from pipenv import cli
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(cli())
Comments