英文:
Inconsistent packages between Jupyter Notebook and Conda Command Line
问题
-
为什么一个环境在
whoiam/opt/anaconda3
,另一个在whoiam/anaconda3
? -
我应该更新 Jupyter Notebook 还是命令行路径?
-
如何更新其中一个路径?
-
我应该通过哪个来安装软件包以避免这个问题?
英文:
I just installed PyTorch and am trying to use it in my Jupyter Notebook. In the notebook, when I run conda list
, I see the following:
# packages in environment at /Users/whoiam/opt/anaconda3:
#
# Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py37_0
alabaster 0.7.12 py37_0
anaconda 2019.10 py37_0
anaconda-client 1.7.2 py37_0
anaconda-navigator 1.9.7 py37_0
anaconda-project 0.8.3 py_0
...
python 3.7.4 h359304d_1
python-dateutil 2.8.0 py37_0
python-libarchive-c 2.8 py37_13
python.app 2 py37_9
pytz 2019.3 py_0
...
But, in the command line of my terminal, I see this:
(base) whoiam@MacBook-Pro Downloads % conda list
# packages in environment at /Users/whoiam/anaconda3:
#
# Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py37_0
alabaster 0.7.12 py37_0
anaconda 2019.10 py37_0
anaconda-client 1.7.2 py37_0
anaconda-navigator 1.9.7 py37_0
anaconda-project 0.8.3 py_0
...
python 3.7.4 h359304d_1
python-dateutil 2.8.0 py37_0
python-libarchive-c 2.8 py37_13
python.app 2 py37_9
pytorch 1.3.0 py3.7_0 pytorch
pytz 2019.3 py_0
...
I have a few questions:
- Why is one environment at
whoiam/opt/anaconda3
and the other atwhoiam/anaconda3
? - Should I be updating the Jupyter Notebook or the Command Line path?
- How do I update either path?
- Through which should I install packages to avoid this issue?
答案1
得分: 0
你应该创建并使用一个conda环境,而不是(base)
。
创建后,你应该通过Anaconda导航器或使用source activate yourenvname
来激活这个环境。你会看到类似以下的内容:
(yourenvname) whoiam@MacBook-Pro Downloads
在终端中,如果你的名为yourenvname的环境被激活。
只有在这样做之后,你才能在终端中通过pip install
来安装你的包,然后打开你的Jupyter笔记本,或直接在Jupyter笔记本中安装你的包。通过激活环境,你确保所有的包都在同一个且唯一的目录中。
英文:
You should create and use one conda enviroment other than (base)
.
After creating it, you should activate this env, through anaconda navigator or with source activate yourenvname
. You will see something like:
(yourenvname) whoiam@MacBook-Pro Downloads
In the terminal, if your enviroment, with the name yourenvname is activated.
Only after doing this, you can install your packages via pip install
in the terminal and then open you jupyter notebook, or directly install your packages in the jupyter notebook. By activating the env you ensure that all your packages are in the same and only directory.
答案2
得分: 0
在(base)命令行中运行Jupyter Notebook解决了我的问题:
在基础环境中执行jupyter notebook
。
英文:
Running jupyter notebook in (base) Command Line solved my problem:
Execute jupyter notebook
in base.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论