'Pipenv error "No Python at 'C:\Python39\python.exe' "
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}\AppData\Local\Programs\Python\Python39\lib\site-packages\pip (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:\Python39\python.exe'
.
Python sys path is C:\Users\{MyUserName}\AppData\Local\Programs\Python\Python39
, so why does pipenv look into another folder? And how can I fix this?
I'm running all these commands in git bash.
Solution 1:[1]
I solved this by manually creating C:\Python39\
and copying python.exe
there. Now it works fine.
Solution 2:[2]
For anyone running into this error, run the following to delete the virtual environment (built with the previous/future version of Python):
cd < to dir where your current virtualenv and pipfile exists>
pipenv --rm
Then rerun this to build your pipenv virtual environment with your new version of Python:
pipenv install
Solution 3:[3]
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
Solution 4:[4]
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}\AppData\Local\Programs\Python\Python39" on the Path
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | akai |
Solution 2 | Rishi Latchmepersad |
Solution 3 | Ugo Guazelli |
Solution 4 | Renato Moratti |