zoukankan      html  css  js  c++  java
  • Python3和Python2共用

    参考:https://www.zhihu.com/question/21653286

    1.使用启动器py.exe

    py -2 使用python2,如: py -2 hello.py

    py -3 使用python3,如: py -3 hello.py

    2. 指定文件由python2解释运行,还是由python3解释运行

    在文件头增加

    #! python2

    #! python3

    3. 运行pip

    py -2 -m pip install XXXX

    py -3 -m pip install XXXX

    -2 还是表示使用 Python2,-m pip 表示运行 pip 模块,也就是运行pip

    4. #! python2 和 # coding: utf-8 哪个写在前面?

    #! python2

    # coding: utf-8

  • 相关阅读:
    day 01
    day14
    day12
    day13
    day11
    day9
    day10
    day08
    day07
    day06
  • 原文地址:https://www.cnblogs.com/zhaohz/p/12117175.html
Copyright © 2011-2022 走看看