简体   繁体   English

酿造python与未酿造的ipython

[英]brew python versus non-brew ipython

I installed python via brew, and made it my default python. 我通过brew安装了python,并将其设置为我的默认python。 If I run which python , I obtain /usr/local/bin/python . 如果运行which python ,我将获得/usr/local/bin/python Also pip is installed via brew, which pip returns /usr/local/bin/pip . 另外pip是通过brew安装的, which pip返回/usr/local/bin/pip

I do not remember how I installed ipython, but I didn't do it via brew, since when I type which ipython , I obtain /opt/local/bin/ipython . 我不记得我是如何安装ipython的,但是我不是通过brew来完成的,因为当我键入which ipython ,我会获得/opt/local/bin/ipython Is it the OS X version of ipython? 它是iPython的OS X版本吗?

I installed all libraries on this version of ipython, for example I have matplotlib on ipython but not on python. 我在此版本的ipython上安装了所有库,例如,我在ipython上具有matplotlib,但在python上却没有。 I do not want to re-install everything again on the brew python, rather continue to install libraries on this version of ipython. 我不想再次在brew python上重新安装所有内容,而是继续在此版本的ipython上安装库。 How can I install new libraries there? 如何在那里安装新库? For example, Python Image Library, or libjpeg? 例如,Python图像库还是libjpeg?

If possible, I would like an exhaustive answer so to understand my problem, and not just a quick fix tip. 如果可能的话,我想提供一个详尽的答案,以便理解我的问题,而不仅仅是快速解决问题的技巧。

I installed python via brew , and made it my default python. 我通过brew安装了python ,并将其设置为我的默认python。 If I run which python , I obtain /usr/local/bin/python . 如果运行which python ,我将获得/usr/local/bin/python

Okay, good so far. 好的,到目前为止很好。

Also pip is installed via brew , which pip returns /usr/local/bin/pip . 另外pip通过brew安装,该pip返回/usr/local/bin/pip

Actually, not quite brew install python would have installed pip because even doing brew search pip comes up with this warning. 其实,不是很brew install python就已经安装了pip ,因为即使做brew search pip此警告出现。

If you meant "pip" precisely:

Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:
  https://pip.readthedocs.io/en/stable/installing/

So, Python came with pip, not brew install 因此,Python带有pip,而不是brew install

when I type which ipython , I obtain /opt/local/bin/ipython . 当我键入which ipython ,我获得/opt/local/bin/ipython Is it the OSX version of ipython? 它是ipython的OSX版本吗?

There is no "OSX version of ipython"... 没有“ ipython的OSX版本” ...

I installed all libraries on this version of ipython, for example I have matplotlib on ipython but not on python. 我在此版本的ipython上安装了所有库,例如,我在ipython上具有matplotlib ,但在python上却没有。

You actually did install them to your brew installed Python. 您实际上确实将它们安装到brew安装的Python中。 IPython is not a new installation of Python. IPython不是Python的新安装。

You can even start a python interpreter from the terminal and import matplotlib to check this 您甚至可以从终端启动python解释器,然后import matplotlib进行检查

I do not want to re-install everything again on the brew python 我不想在brew python上再次重新安装所有内容

What exactly needs re-installed? 究竟需要重新安装什么? It's already installed into the brew python 它已经安装到brew Python中

To transfer all your packages you can use pip to freeze all of your packages installed in ipython and then install them all easily from the file that you put them in. 要传输所有软件包,可以使用pip冻结ipython中安装的所有软件包,然后从放置它们的文件中轻松安装所有软件包。

pip freeze > requirements.txt

then to install them from the file pip install -r requirements.txt 然后从文件pip install -r requirements.txt安装它们

I'm not entirely sure if I understood what you're asking so if this isn't what you want to do please tell me. 我不确定我是否理解您的要求,因此,如果不是您要执行的操作,请告诉我。

OK, so I solved by uninstalling macport (and so the ipython I was using, which was under /opt/local/bin) and installing ipython via pip. 好的,所以我通过卸载macport(以及我正在使用的ipython,位于/ opt / local / bin下)并通过pip安装ipython来解决。 Then I re-install what I needed (eg jupyter) via pip. 然后,我通过pip重新安装需要的内容(例如jupyter)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM