Pipenv error "No Python at 'C:Python39python.exe' "

Question:

I installed and added Python3.9 and Pip to the PATH through the installer.

python --version
# Python 3.9.7
pip --version
# pip 21.2.4 from C:Users{MyUserName}AppDataLocalProgramsPythonPython39libsite-packagespip (python 3.9)

I installed pipenv with pip install pipenv and pipenv --version outputs pipenv, version 2021.5.29. Although, if I try to install any package with pipenv, or just enter the pipenv shell and then run python --version, I always get No Python at 'C:Python39python.exe'.

Python sys path is C:Users{MyUserName}AppDataLocalProgramsPythonPython39, so why does pipenv look into another folder? And how can I fix this?

I’m running all these commands in git bash.

Asked By: akai

||

Answers:

I solved this by manually creating C:Python39 and copying python.exe there. Now it works fine.

Answered By: akai

You will need a copy of get-pip.py

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Next, run the following command to install pip:

python get-pip.py

Also, make sure you have Python in your Windows Environment Variables

Press WIN+R and then type SystemPropertiesAdvanced

In System variables add the Python path

enter image description here

Answered By: Ugo Guazelli

For anyone running into this error, run the following to delete the virtual environment (built with the previous/future version of Python):

    cd $project_folder
    pipenv --rm

Then rerun this to build your pipenv virtual environment with your new version of Python:

pipenv install
Answered By: Rishi Latchmepersad

I solved this problem removing the "C:Python39" from the Path (the older Python version I’ve deleted) and leting only the "C:Users{MyUserName}AppDataLocalProgramsPythonPython39" on the Path

Answered By: Renato Moratti

So I was having the same problem and I clicked at the pyvenv.cfg file in my virtual environment’s folder. ‘home’ was C:Program Files at default. So I changed it to the right path and it worked.

Answered By: Berk

Look for it in AppDataRoamingPythonPythonXscripts

Answered By: Carlost
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.