Python 虚拟环境、包管理与进程处理
1. 虚拟环境 virtualenv
virtualenv 是一个强大的工具,用于创建独立的 Python 虚拟环境,避免不同项目之间的依赖冲突。
1.1 创建不同 Python 版本的虚拟环境
可以使用以下命令分别创建 Python 2.4 和 Python 2.5 的虚拟环境:
$ virtualenv-py24 /tmp/sandbox/py24ENV New python executable in /tmp/sandbox/py24ENV/bin/python Installing setuptools.................done. $ /tmp/sandbox/py24ENV/bin/python Python 2.4.4 (#1, Dec 24 2007, 15:02:49) [GCC 4.0.1 (Apple Inc. build 5465)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> $ ls /tmp/sandbox/py24ENV/ bin/ lib/ $ ls /tmp/sandbox/py24ENV/bin/ activate easy_install* easy_install-2.4* python* python2.4@