How to use multiple versions of Python without uninstallation

前端 未结 15 1552
醉梦人生
醉梦人生 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:15

    For those using windows, if you're not averse to using PowerShell, you can install python 2 and 3 separately as mentioned in other answers. Then you can do this:

    Set-Alias python27 [some path]\python27\python.exe 
    Set-Alias python33 [some path]\python33\python.exe
    

    To create an alias for running each version.

    Keeping aliases around is described in this link: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/about/about_aliases#saving-aliases

    In order to successfully load the profile that that link would have you create, you may need to change your execution policy.

    Set-ExecutionPolicy RemoteSigned
    

    should do the trick, but if you want to know more about execution policies you may want to follow this link: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/about/about_execution_policies

提交回复
热议问题