zhaohz

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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

 

posted on 2019-12-29 23:36  zzhaoh  阅读(407)  评论(0编辑  收藏  举报