Python 选定的库
我正在运行 RHEL5 ,并且安装了 python 2.4。请不要问为什么是本机版本? 我的问题是,在我的主目录中,我想仅使用选定的软件包安装 python2.6,而且最重要的是,我不想要任何库操作系统或任何其他处理系统调用或邮箱首选项的操作系统(禁止发送邮件)是否可以安装仅包含选定库的 python 版本。 所以现在系统上存在 python 2.4 和选定的 2.6 库
I am running RHEL5 , and i have python 2.4 installed on it.Please dont ask why the native version?
My question is that in my home directory i want to install python2.6 with selected packages only and also most importantly i dont want any of the library os or any other which deals with system calls or mail box preferences(sending mail to be prohibited).Is it possible to install a python version with selected libraries only.
So now on the system python 2.4 and selected libraries of 2.6 exists
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能不完全是您正在寻找的...但以下步骤将完成与此类似的操作(如果您具有 root 访问权限)。以下步骤假设您使用 i386 架构。
1) 在系统上并行安装 Python 2.6(需要 root)。它可以在 EPEL 存储库中找到:
2) 通过运行(再次以 root 身份)安装 setuptools:
3) 安装 virtualenv (http://pypi.python.org/pypi/virtualenv):
4) 从您的主目录中,创建一个新的python 环境:
5) 激活环境:
您现在可以使用 easy_install 安装您想要的任何软件包,从 ~/my-env/lib/python26/site-packages 中删除您不需要的任何软件包, 您
为了让您知道您正在虚拟环境中工作,您的提示符将如下所示:
必须注意的一件事是以 #!/usr/bin/python 开头的 python 脚本,因为他们不会使用环境版本。要确保使用环境版本,请像这样执行脚本:
或者您可以在脚本中专门指定环境版本:
This may not be quite what you're looking for... but the following steps will accomplish something similar to this (if you have root access). The below steps assume you are on i386 architecture.
1) Install Python 2.6 in parallel on your system (requires root). It is available at the EPEL repository:
2) Install setuptools by running (again as root):
3) Install virtualenv (http://pypi.python.org/pypi/virtualenv):
4) From your home directory, create a new python environment:
5) Activate the environment:
You can now use easy_install to install whatever packages you want, remove anything you don't want from ~/my-env/lib/python26/site-packages, etc.
To let you know you are working in the virtual environment, your prompt will look like this:
One thing you have to be careful about is python scripts that start with #!/usr/bin/python, as they will not use the environment version. To ensure that the environment version is used, execute your script like this:
Or you can specifically specify your environment version in your scripts:
尝试 ActivePython - 它安装到一个独立的目录(例如:
/opt/ActivePython-2.6
),您可以使用 PyPM 安装第三方 -派对套餐。Try ActivePython - it installs to an isolated directory (eg:
/opt/ActivePython-2.6
), and you can use PyPM to install third-party packages.