Home > Backend Development > Python Tutorial > How Can I Manage Multiple Python Versions (e.g., 2.5 and 2.6) on Windows?

How Can I Manage Multiple Python Versions (e.g., 2.5 and 2.6) on Windows?

Barbara Streisand
Release: 2024-12-04 18:42:12
Original
395 people have browsed it

How Can I Manage Multiple Python Versions (e.g., 2.5 and 2.6) on Windows?

Managing Multiple Python Versions on Windows

Question:

You have two Python versions (2.5 and 2.6) installed on Windows and want to selectively use them for different projects. How can you specify which version to run?

Answer:

Explicit Invocation

To run a specific Python version, explicitly invoke its executable. Instead of typing python in the command line, use the full executable path. For example:

C:\python.5\python.exe
C:\python.6\python.exe
Copy after login

Environment Variable Manipulation

Windows examines environment variables to locate executables. You can manipulate the %PATH% variable to control which Python executable is prioritized.

  1. Open the Control Panel.
  2. Go to "System and Security" > "System."
  3. Click on "Advanced system settings."
  4. Under the "Advanced" tab, click on "Environment Variables."
  5. Edit the %PATH% variable to include the directories of both Python versions in the following order:
%PATH%;C:\python.5;C:\python.6
Copy after login

Now, when you type python in the command line, the 2.5 executable will be used first. You can also create shortcuts on your desktop or Start menu that point to the specific Python executables.

The above is the detailed content of How Can I Manage Multiple Python Versions (e.g., 2.5 and 2.6) on Windows?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template