Hello Xenia,
Thank you for your question and for reaching out with your question today.
Based on the information provided, it seems like you have both Python 3.11.4 and Python 3.7.4 installed on your system, and when you run the python
command in PowerShell, it is invoking Python 3.7.4 instead of the newly installed Python 3.11.4.
To run Python 3.11.4 in your PowerShell, you can try the following:
- Use the Full Path: Instead of just running
python
, specify the full path to the Python 3.11.4 executable. The exact path may vary based on your installation, but it should be something like:PS C:\Users\XXX> C:\path\to\python3.11.4\python
- Check Environment Variables: Ensure that the environment variable for the Python 3.11.4 installation is set correctly. The
PATH
environment variable should include the path to the Python 3.11.4 executable directory. You can check this by running:
If the Python 3.11.4 path is missing, you can add it using the following command (replacePS C:\Users\XXX> $env:PATH
C:\path\to\python3.11.4
with the actual path):PS C:\Users\XXX> $env:PATH += ";C:\path\to\python3.11.4"
- Check File Associations: On Windows, the file association for
.py
files determines which version of Python is used when running scripts without specifying the version. Ensure that Python 3.11.4 is associated with.py
files. You can check this in the "Default apps" settings or use theftype
command in PowerShell:
If it is not associated correctly, you can set it using the following command (replacePS C:\Users\XXX> ftype Python.File
C:\path\to\python3.11.4\python.exe
with the actual path):PS C:\Users\XXX> ftype Python.File="C:\path\to\python3.11.4\python.exe" "%1" %*
After making any changes, close and reopen your PowerShell window to apply the changes. Now, when you run python
, it should invoke Python 3.11.4 instead of the older version.
Note: If you are planning to use Python 3.11.4 more frequently, you might consider uninstalling the older version (Python 3.7.4) to avoid potential conflicts and ensure that your default Python version is the latest one.
I used AI provided by ChatGPT to formulate part of this response. I have verified that the information is accurate before sharing it with you.
If the reply was helpful, please don’t forget to upvote or accept as answer.