2016-03-31 4 views
1

変更カーネル

J-MBP:runtime my$ ll `which python` 
lrwxr-xr-x 1 my admin 34 Mar 31 14:20 /usr/local/bin/python -> ../Cellar/python/2.7.11/bin/python 
J-MBP:runtime my$ python 
Python 2.7.11 (default, Jan 22 2016, 08:29:18) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import sys 
>>> sys.version 
'2.7.11 (default, Jan 22 2016, 08:29:18) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]' 

しかし、私はjupyter notebookを実行し、ダブルチェックPythonのバージョンでは、それはまだ古いバージョンがシステムにプリインストールされています。

import sys 
sys.version 

Out[3]: '2.7.10 (default, Oct 23 2015, 18:05:06) \n[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)]' 

私は、Jupiter Notebookに新しくインストールされたpythonに変更する方法を知っています。

答えて

2

ipython kernel install、現在のカーネルパスを確認してください。 cdそれに続いてvim kernel.json。新しくインストールしたpythonのパスに

{ 
"display_name": "Python 2", 
"language": "python", 
"argv": [ 
    "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/bin/python2.7", 
    "-m", 
    "ipykernel", 
    "-f", 
    "{connection_file}" 
] 
} 

変更のargv引数は、問題を解決します。

0

which jupiterと入力してファイルを編集できます。私はhomebrewからインストールされた以前のバージョンは、そのファイルのシバン行にwhich pythonが返すパスにハードコードされていると思います。

+0

部分的に正しいですが、pythonパスは 'jupyter'ファイルの最初の行でharcodedされます。しかし、新しくインストールされたPythonに切り替えてから再起動しても、使用はありません。 – Judking

関連する問題