How to use multiple versions of Python without uninstallation

前端 未结 15 1865
醉梦人生
醉梦人生 2021-02-05 14:11

I am faced with a unique situation, slightly trivial but painful.

I need to use Python 2.6.6 because NLTK is not ported to Python 3 (that\'s what I could gather).

15条回答
  •  天命终不由人
    2021-02-05 15:00

    You can use py launcher, that is installed with python distributable:

    py -2    # default python 2
    py -2.7  # specifically python 2.7
    py -3    # default python 3
    py -3.7  # specifically python 3.7
    

    If you need to execute a script with a specific version you can do following:

    py -3.7 my_script.py
    

提交回复
热议问题