如果沒有自動連接,如何將 Jupyter 內核連接到 VS Code?
我希望能夠開箱即用地為 VS 代碼工作的 jupyter 筆記本,而我的工作量最少。我試著打開一個 jupyter 筆記本。我立即找到了解釋器并將我的 conda env 與命令顆粒一起使用(command + shift + P然后在下拉菜單中找到了我的 conda env)。這似乎使終端工作,因為 python 指向正確的位置:(automl-meta-learning) brandomiranda~/automl-meta-learning ? which python/Users/brandomiranda/miniconda3/envs/automl-meta-learning/bin/python從 VS Code 運行 python 腳本似乎也可以正常工作,請參閱輸出:(automl-meta-learning) brandomiranda~/automl-meta-learning ? /Users/brandomiranda/miniconda3/envs/automl-meta-learning/bin/python /Users/brandomiranda/automl-meta-learning/python_playground.pyx = 1my_str = this is a stringy = 2但是當我嘗試使用 jupyter notebook 時它不起作用。最明顯的是我的 VS 代碼沒有連接內核,請看截圖:我嘗試按照 reddit 上的建議單擊幾個箭頭(vs_code_jupyter_server_no_kernel_python_not):當我嘗試在我的 jupyter 筆記本中運行時,我收到以下錯誤:Error: Activating Python 3.7.6 64-bit ('base': conda) to run Jupyter failed with Error: StdErr from ShellExec, /Users/brandomiranda/.bashrc: line 31: jump-module.bash: No such file or directoryCommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.To initialize your shell, run $ conda init Currently supported shells are: - bash - fish - tcsh - xonsh - zsh - powershellSee 'conda init --help' for more information and options.IMPORTANT: You may need to close and restart your shell after running 'conda init'..這很奇怪。我的 shell 甚至不是 bash,所以我不知道為什么向我顯示該消息(也許 VS Code 不知道 Mac OS Catalina 使用 zsh?不知道如何為 VS Code 解決這個問題)。無論如何,我繼續做我認為錯誤消息所暗示的事情。所以我做了以下事情:我運行 conda init 然后進入 vs code 內的終端并通過運行 zsh 重新啟動 shell,但 jupyter 內核仍然無法在我的筆記本上運行 vs code。不知道出了什么問題。但似乎沒有什么區別。知道如何解決這個問題嗎?
查看完整描述