V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
oldgun
V2EX  ›  Python

有没有人在windows下用python,你们是如何解决版本切换的问题的?

  •  
  •   oldgun · Jun 23, 2012 · 5016 views
    This topic created in 5056 days ago, the information mentioned may be changed or developed.
    经常改path已经烦了,有现成的解决办法吗,没有的话我打算写个小程序。
    14 replies    1970-01-01 08:00:00 +08:00
    bcxx
        1
    bcxx  
       Jun 23, 2012
    virtualenv?
    kendisk
        2
    kendisk  
       Jun 23, 2012
    我认为 你 开 一个 虚拟机 是不错得选择。
    phuslu
        3
    phuslu  
       Jun 23, 2012
    放到 C:\Python27 或者 C:\Python26 下面,需要切换的时候用管理员权限运行即可。

    https://gist.github.com/2974058
    fanzheng
        4
    fanzheng  
       Jun 23, 2012
    virtualenv
    oldgun
        5
    oldgun  
    OP
       Jun 23, 2012
    @bcxx 我指的是python版本

    @phuslu 谢谢,粗略看了下,满眼的注册表路径,方法跟我打算做的应该是一致的:修改注册表。
    phuslu
        6
    phuslu  
       Jun 23, 2012
    @oldgun 是的,用批处理实现有个好处。
    对于win64+python 32bit, 或者 win64+python 64bit, win32 + python 32bit, 这三种组合都可以用一个批处理搞定。
    oldgun
        7
    oldgun  
    OP
       Jun 23, 2012
    @phuslu 看了一下作者plus就是你?
    phuslu
        8
    phuslu  
       Jun 23, 2012
    @oldgun 恩,自用型。
    oldgun
        9
    oldgun  
    OP
       Jun 23, 2012
    @phuslu 谢谢,收下了,我得空也把我那个实现出来,带gui的。
    phuslu
        10
    phuslu  
       Jun 23, 2012
    @oldgun 恩,当初选择批处理的原因就是 GUI 要考虑 win32/win64 与 python x64/amd64 混合的原因,而且本身的exe也要考虑两个版本。
    oldgun
        11
    oldgun  
    OP
       Jun 23, 2012
    @phuslu 刚刚看了你的代码,直接修改 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment 的Path键值不就可以了吗?
    phuslu
        12
    phuslu  
       Jun 23, 2012
    @oldgun 其他如果不改的话,安装以 exe 发布的第三方库的可能会出问题。
    而且考虑到 注册表的 WOW64 分支,这个修改的 reg 进程父进程要由当前目录的 python.exe 发起。
    oldgun
        13
    oldgun  
    OP
       Jun 23, 2012
    @phuslu 明白了,受教!
    bcxx
        14
    bcxx  
       Jun 23, 2012
    @oldgun 也可以的其实……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3514 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 10:58 · PVG 18:58 · LAX 03:58 · JFK 06:58
    ♥ Do have faith in what you're doing.