我想从Jupiter Notebook运行Python2以及Python3内核。我正在将Anaconda用于Python和Jupyter分发。
Lokeshs-MacBook-Air-2:~ lokeshagrawal$ conda --version
conda 4.5.12
Lokeshs-MacBook-Air-2:~ lokeshagrawal$ which python
/anaconda3/bin/python
Lokeshs-MacBook-Air-2:~ lokeshagrawal$ which jupyter notebook
/anaconda3/bin/jupyter
[![Lokeshs-MacBook-Air-2:~ lokeshagrawal$ python --version
Python 3.7.2
如下图所示,我只有一个选项可以从Jupyter启动Python3内核。我怎样才能同时拥有Python2和Python3?
答案 0 :(得分:3)
2017 :{
name: "Tony",
age: 21,
photo: "some url here"
},
{
name: "Steve",
age: 21,
photo: "some url here"
}
2018 :{
name: "Stark",
age: 19,
photo: "some url here"
},
{
name: "Rogers",
age: 21,
photo: "some url here"
}
Sub CopyDataNEW()
Dim sBook_t As Workbook
Dim sBook_s As Workbook
Dim wbPath_t As String
Dim wbPath_s As String
wbPath_t = "F:\TESt\DB_BA.xlsx"
wbPath_s = "F:\TESt\PPC_BA.xlsm"
Set sBook_s = Workbooks.Open(wbPath_s)
Set sBook_t = Workbooks.Open(wbPath_t)
sBook_s.Sheets("cstdata").Range("A2:EK2").Copy Destination:=sBook_t.Sheets("cstdatalist").Range("A2")
End Sub
顺便说一下,此解决方案来自ipython docs。
答案 1 :(得分:1)
您可以这样做:
conda create —name py2 python=2.7 anaconda
conda activate py2
(py2) conda install ipykernel -y
(py2) python -m ipykernel install --user --name py2 --display-name "Python 2.7"
这将使用Python 2.7创建一个名为py2的环境,并将其添加到名称为Python 2.7的内核中。
如果我们要使用其他版本,例如同样,在Python 3.7中,我们可以执行相同的步骤:
conda update conda
conda create —name py3 python=3.7 anaconda
conda activate py3
(py3) conda install ipykernel -y
(py3) python -m ipykernel install --user --name py3 --display-name "Python 3.7"
注意:您不必添加'anaconda'软件包。希望这可以帮助您了解如何在jupyter内核中添加环境。