参考: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

 

相关文章:

  • 2021-09-08
  • 2021-10-11
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-10
  • 2021-11-26
  • 2021-10-14
  • 2022-12-23
  • 2022-12-23
  • 2021-05-08
相关资源
相似解决方案