avatarDaniel Easterman

Summary

The web content provides a comprehensive guide for Windows users to manage Python versions using pyenv-win, a tool for installing and switching between multiple Python versions.

Abstract

The article titled "For Windows Users: Step-by-step guide on how manage your Python projects with pyenv-win" offers detailed instructions for Windows users to install and manage multiple Python versions using pyenv-win. It begins with an introduction to pyenv-win, explaining its utility in avoiding version conflicts and facilitating code sharing and deployment. The guide includes steps to open PowerShell as an administrator, change execution policies, install pyenv-win, update Python versions, and set both global and local Python versions for projects. It also encourages readers to join a newsletter for exclusive Python and Flask content and to consider becoming a Medium member to support the author and access similar guides. The article concludes with links to resources for further reading on pyenv-win and managing Python environments.

Opinions

  • The author believes pyenv-win is a valuable tool for Windows users working with Python, as it simplifies the management of different Python versions.
  • The guide is presented as user-friendly and essential for Python developers looking to streamline their development environment.
  • The author promotes their newsletter and Medium membership, suggesting that readers will benefit from exclusive content and support the author's work.
  • By providing a step-by-step approach, the author conveys that managing Python versions with pyenv-win is straightforward and beneficial for project consistency and collaboration.
  • The inclusion of external resources indicates the author's endorsement of these materials for readers seeking to deepen their understanding of pyenv-win and Python version management.

For Windows Users: Step-by-step guide on how manage your Python projects with pyenv-win.

Photo by Ashkan Forouzani on Unsplash

What is Pyenv?

Install and manage multiple Python versions on your computer. This makes it easier to share your code with others, deploy your code and generally avoid all those annoying table-flipping moments!

  1. Open a new PowerShell window, and make sure you select the “Run as Administrator” option:

2. Run this command in the PowerShell prompt:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

3. Now run this to install pyenv-win install:

Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"

If everything went well, you should see this:

4. List out all available Python versions:

pyenv install --list

5. If you don’t see the version you want in the list, run the pyenv update command:

pyenv update

6. Now install the specific Python version:

pyenv install 3.10.7

7. Set the global (system-wide) Python version with the global keyword:

pyenv global 3.10.7

8. Verify that your global system is now using the version you just set:

python -V

9. Now you can use the localkeyword to set the application-specific Python version in the root of your project directory:

pyenv local 3.10.7

(This command will automatically create a .python-version file in your project).

If you found this guide useful:

Join my newsletter to get access to exclusive content on Python and Flask

Thanks very much for reading! Join my newsletter to get access to exclusive content on Python and Flask

Also: if you enjoy reading stories like these and want to support me as a writer, consider signing up to become a Medium member. It’s $5 a month, giving you unlimited access to thousands of Python and Flask guides like this one.

If you sign up using my link, I’ll earn a small commission with no extra cost to you.

Resources

This abbreviated guide is derived in part from the following resources which provide more background information on Pyenv:

Python
Windows
Recommended from ReadMedium