多版本python共存的解决方案
2016-07-22 23:06
519 查看
多版本python共存的解决方案
多版本python共存的解决方案不同版本python切换的方法
多版本python共存下使用pip
不同版本python切换的方法
利用Windows Launcherpy -2.7 py -3 py -3 script.py
在python file头添加Unix-style top-of-script comments,如
#!python2 #!/usr/bin/python2.7 #!/usr/bin/env python3
修改Windows 环境变量PATH设置
系统->高级系统设置->环境变量->path->编辑
然後去手動把 python27下面的python.exe改成python2.exe
python35下面的python.exe改成python3.exe
在CMD输入
python2运行python2,输入python3运行python3
多版本python共存下使用pip
py -2 -m pip install XXXX py -3 -m pip install XXXX
原理command-line
python [-bBdEhiIOqsSuvVWx?] [-c command | -m module-name | script | - ] [args]
-m
Search sys.path for the named module and execute its contents as the
__main__module.
Since the argument is a module name, you must not give a file extension (.py). The module-name should be a valid Python module name, but the implementation may not always enforce this (e.g. it may allow you to use a name that includes a hyphen).
Package names (including namespace packages) are also permitted. When a package name is supplied instead of a normal module, the interpreter will execute
<pkg>.__main__as the main module. This behaviour is deliberately similar to the handling of directories and zipfiles that are passed to the interpreter as the script argument.
所以
py -3 -m pip会运行
C:\Python34\Lib\site-packages\pip路径下的
__main__.py
相关文章推荐
- Python动态类型的学习---引用的理解
- Python3写爬虫(四)多线程实现数据爬取
- 垃圾邮件过滤器 python简单实现
- 下载并遍历 names.txt 文件,输出长度最长的回文人名。
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例
- Python中map()函数浅析
- Python将excel导入到mysql中
- Python在CAM软件Genesis2000中的应用
- 使用Shiboken为C++和Qt库创建Python绑定
- FREEBASIC 编译可被python调用的dll函数示例
- Python 七步捉虫法