This is my current python environment setup on Windows 10:
For the remainder of this post I will assume you have chocolatey installed. Also I'm using the bash as admin terminal from cmder.
Install python3 with choco install python and/or choco install python3. Verify that you have the latest python3 version installed with python --version. Then type choco install pyenv-win. This is the easiest way to do this because it also configures the Environment Variables.
Now install the python version you want with pyenv. In this post I'll go with 3.9.0
pyenv update
pyenv install --list
pyenv install 3.9.0
It seems like no matter what you do, your path will always put /c/Python39/python aka not the pyenv version of python first. Even if you set the pyenv section of your path first by going to My Computer > Properties > Advanced System Settings > Environment Variables and move PYENV to the top of the path, your terminal will always see /c/Python39/python as the default version.
Then I install virtualenvwrapper with the pyenv version of python:
export "PATH=/c/Users/<myusername>/.pyenv/pyenv-win/shims/:$PATH"
/c/Users/<myusername>/.pyenv/pyenv-win/shims/pip install virtualenv
/c/Users/<myusername>/.pyenv/pyenv-win/shims/pip install virtualenvwrapper
source /c/Users/<myusername>/.pyenv/pyenv-win/versions/3.9.0/Scripts/virtualenvwrapper.sh
export "PATH=/c/Users/<myusername>/.pyenv/pyenv-win/shims/:/c/Users/<myusername>/.pyenv/pyenv-win/versions/3.9.0/Scripts/:$PATH"
I make a virtual environement like this mkvirtualenv test1. Now the terminal has a (test1) before the prompt so I know that the virtual env is active and working. Before you close out of this terminal, run the command deactivate to stop the virtualenv.
Now when I want to start a python project, I run these commands (Order is really important. If you do the first two commands out of order it won't work until you close and reopen the terminal).
export "PATH=/c/Users/<myusername>/.pyenv/pyenv-win/shims/:/c/Users/<myusername>/.pyenv/pyenv-win/versions/3.9.0/Scripts/:$PATH"
source /c/Users/<myusername>/.pyenv/pyenv-win/versions/3.9.0/Scripts/virtualenvwrapper.sh
workon test1
And finished! That's how I setup my virtual environments in Python.
See how inconvenient that was lol. On my mac it's easy I just run pyenv virtualenvwrapper then workon test1. So how can I do this better? Is there a simpler way to work with python on Windows 10?
P.S. I would prefer not to use PyCharm. I know a lot of people like it but I'm looking for a more text editor/IDE agnostic solution.