Cannot create virtual environment with pipenv

  pipenv, pyenv, python, python-3.x, virtualenv

I was trying to use pipenv along with pyenv following the instruction here to create a virtual environment with python version 3.9 on mac (I use python 3.6 locally), but the environment cannot create properly showing the message below:

unhumanWu-2:project unhumanWu$ pipenv install 3.9
Creating a virtualenv for this project...
Pipfile: /Users/unhumanWu/Documents/Projects/Learning/DataEngineer/productionETL/project/Pipfile
Using /usr/local/bin/python3.9 (3.9.8) to create virtualenv...
⠦ Creating virtual environment...Using base prefix '/Library/Frameworks/Python.framework/Versions/3.9'
New python executable in /Users/unhumanWu/.local/share/virtualenvs/project-PIeNHvH_/bin/python3.9
Not overwriting existing python script /Users/unhumanWu/.local/share/virtualenvs/project-PIeNHvH_/bin/python (you must use /Users/unhumanWu/.local/share/virtualenvs/project-PIeNHvH_/bin/python3.9)
ERROR: The executable /Users/unhumanWu/.local/share/virtualenvs/project-PIeNHvH_/bin/python3.9 is not functioning
ERROR: It thinks sys.prefix is '/Library/Frameworks/Python.framework/Versions/3.9' (should be '/Users/unhumanWu/.local/share/virtualenvs/project-PIeNHvH_')
ERROR: virtualenv is not compatible with this system or executable
Running virtualenv with interpreter /usr/local/bin/python3.9

✘ Failed creating virtual environment 
[pipenv.exceptions.VirtualenvCreationException]: /Users/unhumanWu/anaconda/lib/python3.6/site-packages/ DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp

Failed to create virtual environment.

Then I checked the python version and which python is working now:

unhumanWu-2:productionETL unhumanWu$ which python
unhumanWu-2:productionETL unhumanWu$ python --version
Python 3.6.13 :: Anaconda, Inc.
unhumanWu-2:productionETL unhumanWu$ pyenv versions
* 3.9.7 (set by /Users/unhumanWu/Documents/Projects/Learning/DataEngineer/productionETL/.python-version)

Looks like that there are some conflicts happening here because I cannot use jupyter notebook as before after the process above, it will show message Jupyter command `jupyter-notebook` not found.

Here is my $PATH setting:


How can solve the issue and create a virtual environment properly?

Source: Python Questions