适用于Mac OSX的IPython3 [英] IPython3 for Mac OSX

查看:77
本文介绍了适用于Mac OSX的IPython3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了Ipython,但是它运行在python 2.7.5上,我也安装了python 3.3。如何进行更改,以便Ipython在python 3.3上运行而不是2.7.5?

I have Ipython installed but it runs on python 2.7.5 , I also have python 3.3 installed. How can I make changes such that Ipython runs on python 3.3 not 2.7.5?

推荐答案

您需要安装 pip for Python 3 - 就像转到 pip-installer.org 安装页面并按照说明操作。简而言之,下载 get-pip.py 并将其保存在某个位置,例如下载文件夹。在终端导航,然后运行

You need to install pip for Python 3 - it's as easy as going to the pip-installer.org Installation page and following the instructions. Briefly, download get-pip.py and save it someplace, like your Downloads folder. Navigate there in Terminal, and run

sudo python3 get-pip.py

你很快就会有 pip3 pip-3.3 命令(也许两者都有,我不记得了)。你现在应该可以运行

and you should soon have either a pip3 or pip-3.3 command (maybe both, I don't remember). You should now be able to run

sudo pip3 install ipython[all]

并希望所有依赖项都会安装。如果安装窒息,请使用 pip3 安装 pyzmq tornado pyreadline jinja2 pygments ,也许还有一些其他。确保在开始之前阅读文档,这样您就有了一个想法你想要实现的目标。 IPython很大而且相当复杂,有许多移动部件,因此在没有包管理器的情况下(见下文),在一切运行起来之前可能需要一些时间。

and hopefully all the dependencies will be installed as well. If installation chokes, use pip3 to install pyzmq, tornado, pyreadline, jinja2, pygments, and maybe a few others. Make sure you read the docs before you start, so you have an idea of what you're trying to achieve. IPython is large and quite complex, with many moving parts, so in the absence of a package manager (see below) it can take a bit of time before everything is up and running.

还有其他选择。您可以安装 Anaconda ,这是一个完全免费的企业级Python分发版 - 规模数据处理,预测分析和科学计算包含100多个包,包括IPython及其依赖项。默认情况下,Anaconda安装程序为您提供Python 2.7,但您可以使用 conda 命令来安装Python 3

There are other options, too. You can install Anaconda, a "Completely free enterprise-ready Python distribution for large-scale data processing, predictive analytics, and scientific computing" with over 100 packages, including IPython and its dependencies. By default, the Anaconda installer gives you Python 2.7, but you can use the conda command to install Python 3.

我个人最喜欢的是使用 MacPorts 。是的,它会再次安装Py3,但除非你真的饿死了磁盘空间(在这种情况下你可能不想安装像IPython这样的大包),这没什么大不了的。使用 port 命令,一旦安装了基本MacPorts,您就可以运行

My personal favorite is to install Python 3 and IPython using MacPorts. Yes, it'll install Py3 all over again, but unless you're really starving for disk space (in which case you probably don't want to be installing large packages like IPython) it's no big deal. Using the port command, once the base MacPorts installation has been put in place, you can just run

sudo port install py33-ipython +pyqt4

以及所有其他依赖项将照顾,(希望)完美无瑕,除了等待很长时间,而不是你必须做任何其他事情,而像PyQt这样的东西被编译。你可能还需要运行 sudo port install py33-ipython + notebook 如果你想要笔记本,我不记得是否安装了它。顺便说一句,你确实需要X11,Xcode和MacPorts的Xcode命令行工具,但是如果你做第一个选项可能会需要它们,因为并非所有软件包都有可用于OS X的二进制文件。优秀的文档引导您完成从安装到使用端口命令维护系统的所有内容。我强烈建议您修改〜/ .profile (或〜/ .bash_profile 〜 /.bashrc ,或者等效于你的shell)添加MacPorts安装目录( / opt / local / bin / opt / local / sbin ,默认情况下)到路径的前面。只需将 export PATH ='/ opt / local / bin:/ opt / local / sbin:$ PATH'添加到文件末尾。

and all the other dependencies will be taken care of, (hopefully) flawlessly, without your having to do anything else except wait for a long time while things like PyQt are compiled. You may also need to run sudo port install py33-ipython +notebook if you want the notebook, I don't recall if it's installed otherwise. BTW, you do need X11, Xcode, and the Xcode command-line tools for MacPorts, but they would likely be required if you do the first option as not all packages have binaries available for OS X. The excellent documentation walks you through everything, from installation to using the port command to maintaining your system. I would highly recommend modifying your ~/.profile (or ~/.bash_profile, ~/.bashrc, or equivalent for your shell) to add the MacPorts install directories (/opt/local/bin and /opt/local/sbin, by default) to the front of your path. Just add export PATH='/opt/local/bin:/opt/local/sbin:$PATH' to the end of the file.

第三种选择是使用 Homebrew 。它与MacPorts类似,因为 brew 命令是一种包管理器,如 port conda ,但根据我的经验,它没有那么多的包,并且不能像 port 那样无缝地工作。但是,我对StackOverflow, Ask Different 和其他论坛的观察似乎表明,大约50%的人拥有 brew 并且不喜欢 port ,而另一半喜欢 port over 冲泡。 YMMV。

A third alternative option is to use Homebrew. It's similar to MacPorts, in that the brew command is a type of package manager like port and conda, but in my experience it doesn't have as many packages, and doesn't quite work as seamlessly as port. However, my observations on StackOverflow, Ask Different and other fora seem to indicate that about 50% of people have great experiences with brew and don't like port, while the other half loves port over brew. YMMV.

我希望这会有所帮助。祝你安装好运!

I hope this helps. Good luck with your installation!

这篇关于适用于Mac OSX的IPython3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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