作法:Macports选择python [英] How to: Macports select python

查看:104
本文介绍了作法:Macports选择python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我输入:

port select --list python

这是结果:

Available versions for python:
    none
    python25 (active)
    python25-apple
    python26-apple
    python27
    python27-apple

我认为当我使用python时,我会使用版本2.5.相反,当我输入"python"时,版本2.7似乎处于活动状态.如何将其更改为2.5版?

I thought when I use python I would be using version 2.5. Instead when I enter "python", version 2.7 seems to be active. How do I change that to version 2.5?

Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

推荐答案

为什么会这样

MacPorts默认将二进制文件安装到/opt/local .

Mac上还预装了 python.只需键入python即可启动,它将启动不受MacPorts安装影响的预安装python版本.

There is also a preinstalled python on your Mac. When just typing python to start, it will start the preinstalled python version not affected by MacPorts install.

要查看仅在键入python use时将执行什么版本

To see what version will be executed when just typing python use

which python

要启动mac端口版本,请使用

To start the mac ports version use

/opt/local/bin/python2.5

解决方案

如果您希望始终使用MacPorts二进制文件,则可以更改路径,以使/opt/local/bin出现在之前 /use/local/bin等.

/opt/local/bin等添加到〜/.tcshrc中.另外,请务必查看〜/.profile和〜/.bash_profile,因为它们是Mac上的默认设置.

/opt/local/bin etc. are added in ~/.tcshrc by MacPorts. Also be sure to look in ~/.profile and ~/.bash_profile as these are default on mac.

首先输入port select --list python列出已安装的版本,然后例如输入sudo port select --set python python27选择2.7.有关更多信息,请输入port help select.

First type port select --list python to list installed version, then just for example sudo port select --set python python27 to select 2.7. For more information type port help select.

这篇关于作法:Macports选择python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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