MacのVisual Studio Codeで
アドオンのJupyterを使用しています。
Visual Studio Code上でJupyterを使用したいのですが、
pyenv localで使用するPythonを指定している場合エラーになってしまいます。
プロジェクトディレクトリは以下のようになっています。
(anaconda3-4.3.1) $ tree -a . ├── .python-version ├── settings.json └── titanic └── test.py 1 directory, 3 files
このディレクトリではpyenvでanaconda3-4.3.1のPythonを使用するようにしています。
(anaconda3-4.3.1) $ pyenv versions system * anaconda3-4.3.1 (set by /Users/hoge/Documents/workspace/hogeproject/.python-version)
ちなみにsystemのpythonバージョンはですが
$ python --version Python 2.7.10
となっておりプロジェクトディレクトリのpythonバージョンは
(anaconda3-4.3.1) $ python --version Python 2.7.10 (anaconda3-4.3.1) $ python3 --version Python 3.6.0 :: Anaconda 4.3.1 (x86_64)
となっております。
プロジェクトルートに置いているsettings.jsonですが
settings.json
1{ 2 "python.pythonPath": "/Users/hoge/.pyenv/shims/python", 3 "python.venvPath": "~/.pyenv" 4}
と記載しています。
Visual Studio Codeを起動し、
Run cellでグラフを描画を試みたところエラーになってしまいます。
###発生している問題・エラーメッセージ
Unable to determine version of Jupyter, pyenv: jupyter: command not found The `jupyter' command exists in these Python versions: anaconda3-4.3.1 Failed to detect Jupyter Notebook. Please use 'Select Jupyter Notebook' command
###該当のソースコード
test.py
1#%% 2import matplotlib.pyplot as plt 3import matplotlib as mpl 4import numpy as np 5 6x = np.linspace(0, 20, 100) 7plt.plot(x, np.sin(x)) 8plt.show()
###試したこと
pyenv local の場合はエラーになりますが、
$ pyenv global anaconda3-4.3.1
でglobalに設定して、Run Cellすると
Jupyterが起動してグラフが表示されました。
Starting Jupyter Notebook jupyter notebook --no-browser --port=8888 --NotebookApp.allow_origin="*" [I 08:09:14.626 NotebookApp] Serving notebooks from local directory: /Users/hoge/Documents/workspace/hogeproject [I 08:09:14.627 NotebookApp] 0 active kernels [I 08:09:14.627 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=d20c07a1e0cc710693e999b6f5f9eb23ab42f4d5660abcde [I 08:09:14.627 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 08:09:14.627 NotebookApp] Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://localhost:8888/?token=d20c07a1e0cc710693e999b6f5f9eb23ab42f4d5660abcde [I 08:09:17.118 NotebookApp] Kernel started: 22392318-ee0a-4407-8e8e-b56a11eabcde
###補足情報(言語/FW/ツール等のバージョンなど)
pyenvのバージョンはpyenv 1.0.10
MacのOSのバージョンはmacOS Sierra 10.124
Visual Studio Codeのバージョンは1.11.2
となります。
どうしてpyenv localだとJupyterが動作しないのかご教示いただけないでしょうか?
あなたの回答
tips
プレビュー