美文网首页
python多版本切换

python多版本切换

作者: ArcherZang | 来源:发表于2019-12-31 22:49 被阅读0次

    多版本切换

    1. 首先添加所有版本Path


      image.png
    2. 修改文件名


      image.png
    3. 输入不同版本名称


      image.png
    4. 为不同版本安装第三方模块


      image.png

    更好的方式
    当python脚本需要python2运行时,只需在脚本前加上,然后运行py xxx.py即可。

    #! python2
    当python脚本需要python3运行时,只需在脚本前加上,,然后运行py xxx.py即可。
    #! python3
    就这么简单。
    

    同时,这也完美解决了在pip在python2和python3共存的环境下报错,提示Fatal error in launcher: Unable to create process using '"'的问题。

    当需要python2的pip时,只需
    py -2 -m pip install xxx
    
    当需要python3的pip时,只需
    py -3 -m pip install xxx
    

    相关文章

      网友评论

          本文标题:python多版本切换

          本文链接:https://www.haomeiwen.com/subject/uvnioctx.html