【问题标题】:when calling jupyter notebook from command line open it in conda从命令行调用 jupyter notebook 时,在 conda 中打开它
【发布时间】:2020-04-21 06:09:26
【问题描述】:

我安装了 conda,当我打开 jupyter notebook 时,它会在此处打开:

 >>> import sys
 >>> print(sys.executable)
 >>> print(sys.version)
 >>> print(sys.version_info)
/Users/cmougan/opt/anaconda3/bin/python
3.7.4 (default, Aug 13 2019, 15:17:50) 
[Clang 4.0.1 (tags/RELEASE_401/final)]
sys.version_info(major=3, minor=7, micro=4, releaselevel='final', serial=0)

但是当我从命令行打开 jupyter notebook 时,它会出现在这里:

 >>> import sys
 >>> print(sys.executable)
 >>> print(sys.version)
 >>> print(sys.version_info)
/usr/local/opt/python/bin/python3.7
3.7.5 (default, Nov  1 2019, 02:16:23) 
[Clang 11.0.0 (clang-1100.0.33.8)]
sys.version_info(major=3, minor=7, micro=5, releaselevel='final', serial=0)

似乎我在 pip install packages 时遇到了同样的错误。

我的问题是:

如何从终端打开(并使用 pip install)conda jupyter notebook?

【问题讨论】:

  • 你安装了多个python版本。

标签: python python-3.x pip jupyter-notebook anaconda


【解决方案1】:

你有多个python3的安装

/Users/cmougan/opt/anaconda3/bin/python/usr/local/opt/python/bin/python3.7

作为一种快速修复,在从终端调用 jupyter 之前使用 alias 命令。

alias python=/Users/cmougan/opt/anaconda3/bin/python

【讨论】:

    【解决方案2】:

    在从命令行打开 jupyter notebook 之前,请确保已激活运行源以预先切换到正确的环境。

    假设您有一个名为“py36”的 anaconda 环境:

    source activate py36
    jupyter notebook
    

    如果您还没有设置 anaconda 环境,请考虑这样做。这是一个有用的链接:https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-12
      • 2018-04-29
      • 2020-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-13
      • 2019-03-04
      相关资源
      最近更新 更多