Windows下实现Python2和Python3两个版共存的方法
Jun 10, 2016 pm 03:10 PM一直用的是python2,从python 2.3到python 2.7.6, 出于想了解python3的新特性,又安装了python3.3.3. 用了才发现蛮方便的。python的各个版本是独立共存的,不相互冲突的。下面说下如何操作:
1. 独自安装好python2.7.6 和 python3.3.3
2. 修改注册表: 打开->regedit
HKEY_CLASSES_ROOT\Python.File\shell\open\command的默认值
修改为"C:\Python27\python.exe" "%1" %*(C:\Python27是我的Python2.7安装路径),
同时将C:\Python27\和C:\Python27\Scripts\添加到环境变量中。
3.在C:\Python27\中新建一个python33.bat的文件,并运行这个文件
@ echo off
C:\Python33\python.exe %*
效果:
如果我想用python2.7.6的时候就输入 python27,想用python3.3.3的时候,就输入python33
D:\Python>python27 2to3Test.py
Hello,World!
D:\Python>python33 2to3Test.py
Hello,World!
还是挺方便的。

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

What should I do if I can't delete a Windows system dll file? Tips for completely deleting stubborn dll files

Lossless Scaling on Steam Deck OLED runs games at up to 2x FPS

How to turn off Security Center in Windows 11

Windows 10 vs. Windows 11 performance comparison: Which one is better?

How to update the latest version of Bybit Exchange? Will there be any impact if it is not updated?

deepseek web version entrance deepseek official website entrance

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node?
