Python 环境管理与进程处理实用指南
1. 虚拟环境管理
1.1 创建不同 Python 版本的虚拟环境
虚拟环境对于隔离项目依赖非常有用。以下是创建 Python 2.4 和 Python 2.5 虚拟环境的示例:
# 创建 Python 2.4 虚拟环境
$ virtualenv -py24 /tmp/sandbox/py24ENV
New python executable in /tmp/sandbox/py24ENV/bin/python
Installing setuptools.................done.
# 进入 Python 2.4 虚拟环境
$ /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.
>>>
# 查看 Python 2.4 虚拟环境目录结构
$ ls /tmp/sandbox/py24ENV/
bin/ lib/
# 查看 Python 2.4 虚拟环境 bin 目录内容
$ ls /tmp/sandbox/py24ENV/bin/
activate easy_install* easy_install-2.4* python* python2.4@
# 创建
超级会员免费看
订阅专栏 解锁全文
3054

被折叠的 条评论
为什么被折叠?



