在MacOSX for Eclipse上多次安装Python [英] Multiple installs of Python on MacOSX for Eclipse

查看:103
本文介绍了在MacOSX for Eclipse上多次安装Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想安装多个Python:2.1、2.4、2.7、3.x
我的IDE是MacOSX上的Eclipse(Helios)/Pydev,效果很好.我有几个正在/将要在不同版本的Python上运行的Python代码库.另外,我喜欢Eclipse PyDev从源代码到文档的交联.

I want to have multiple installs of Python: 2.1, 2.4, 2.7, 3.x
My IDE is Eclipse (Helios)/Pydev on MacOSX, which works great. I have a couple of Python codebases that are/will be running on different versions of Python. Also, I like Eclipse PyDev's crosslinking from source-code to documentation.

标准建议似乎是:使用virtualenv,并使安装与内置的MacPython(2.6.1)完全分开. Eclipse永远不要指向MacPython安装. (PYTHONPATH甚至应该在这样的环境中设置吗?)

The standard recommendation seems to be: use virtualenv, and keep the installs totally separate from the builtin MacPython (2.6.1). Eclipse should never be pointing to the MacPython install. (Should PYTHONPATH even be set in such an environment?)

在我开始使用virtualenv之前,我还应该了解什么吗? virtualenv不会增加任何开销,我不应该为偶尔出现的鼻子破裂,覆盖范围等问题而担心吗?

Before I get on with virtualenv, is there anything else I should know about this? virtualenv doesn't impose any overhead, and I shouldn't be worried with occasional comments about breakage to nose, coverage etc?

我想听听MacOS上的Eclipse或Pydev用户的消息.
另外,如果有人对从2.1-> 2.7迁移Python代码库有其他提示.

I'm interested in hearing from Eclipse or Pydev users on MacOS.
Also if anyone has other tips on migrating a Python codebase from 2.1 -> 2.7.

推荐答案

一个好方法是使用 macport 安装不同版本的python.对于所需的所有python版本,它将具有所有软件包的不同版本.它们将安装在/opt/local/中. 因此,在带有针对特定项目的PyDev的Eclipse中,您可以右键单击项目名称->属性:在那里,在左侧选择 PyDev-解释器/语法.然后,您单击链接单击此处以配置解释器而不是列表器.您点击新窗口右上角的新建.如果已经通过 macport 安装了所有必需的软件包,则输入要为其创建解释器的python版本的名称.然后在可执行解释器字段中输入路径:/opt/local/bin/pythonX.X . 之后,在上一个选项窗口中: PyDev-解释器/语法,您可以在解释器菜单中选择刚安装的python版本.

A good way is to use macport to install the different version of pythons. It will have different versions of all packages for all versions of pythons that you want. They will be installed in /opt/local/. So in Eclipse with PyDev for a particular project you can right click into the name of the project -> properties: There, in the left you choose PyDev - Interpreter/Grammar. And you click the link Click here to configure an interpreter not lister. You click on new on the top right of the new window. You give the name of the version of python you want to create the interpreter for, if you have already installed it with all required package through macport. And in the field Intepreter Executable you give the path: /opt/local/bin/pythonX.X . After, in the previous option window: PyDev - Intepreter/Grammar, you can choose in the Interpreter menu the python version that you just installed.

对于外壳,您必须使用指向/usr/bin/python 的默认路径: python_select (通过macport安装)而不是使用 env 变量.之后,您可以使用 macport 来更新/安装新软件包,确保一切都保持清洁.

For the shell, and the default path pointing to /usr/bin/python you must use: python_select (installed through macport) instead of playing with the env variables. Afterward you can use macport to update/install new packages, make sure everything is alway clean.

这篇关于在MacOSX for Eclipse上多次安装Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆