0

We have a python application that runs in all our environments on python 3.8.8. I would like to see if upgrading it to python 3.11 and the respective packages will cause anything to crash and burn.

I have created a virtual environment on the dev server using venv. When I activate this virtual environment and do a python --version it displays 3.8.8. I have also installed python 3.11.1 but during the installation i chose not to add environmental variables or update the path just incase it would start defaulting to 3.11.1 which would affect the work of other teams.

I have tried running python -m venv --upgrade path\to\my\venv without the venv activated and it seems to work because i dont get any error and it returns to the command prompt. However when i activate the venv and check the version it is still 3.8.8.

My questions are, if i have multiple python versions installed how do i tell venv to use a specific one and for this to all work should i have updated the path and the environmental variables for the new version of python during the install?

Alot of posts online are about virtualenv. Should i use this instead?

lem
  • 149
  • 7
  • Does this answer your question? [How do I update a Python virtual environment with \`venv\` (in Python 3.3+) to use a newer version of Python?](https://stackoverflow.com/questions/58562928/how-do-i-update-a-python-virtual-environment-with-venv-in-python-3-3-to-use) – Adrian W Feb 01 '23 at 20:56
  • not sure how the env was created for 3.11, please refer [env with python version](https://stackoverflow.com/questions/75129920/how-to-config-python-virtual-environment-with-a-specific-python-version/75130194#75130194)to create specific python version env. let me know for any questions. – simpleApp Feb 01 '23 at 20:59
  • See also [Upgrade python in a virtualenv](https://stackoverflow.com/q/10218946/2311167). However, that more or less recommends what you seem to have done already. That _should_ work. Alternative: just re-create the venv with the new Python version. That should be rather fast nowadays. – Adrian W Feb 01 '23 at 21:06

0 Answers0