0

非常沮丧*。代码适用于 jupyter 实验室,但不适用于 Visual Studio Code。

我创建了干净的新环境,安装、删除、重新安装 [小时过去了]。我已经按照说明安装(在干净的环境中)[例如,conda install -c pyviz/label/dev holoviews]

这里是我使用的版本

hvplot.version = ‘0.6.0’
holoviews.version =‘1.13.3’
pd.version = ‘1.0.5’

我有以下简单的代码……来自你的一个教程

'''

import hvplot.pandas  # noqa

from bokeh.sampledata.iris import flowers
import hvplot

#%%

flowers.hvplot.plot(x=‘sepal_width’, y=‘sepal_length’, width=600, groupby=‘species’, kind=‘scatter’ )

'''

这是我设法在调试器中捕获的

SyntaxError: Unexpected token ‘?’
    at runCodeHere (vscode-resource://file///c%3A/Users/cg/.vscode/extensions/ms-python.python-2020.6.91350/out/datascience-ui/notebook/vendors~nteract_transforms.bundle.js:2:11588)
    at t.value (vscode-resource://file///c%3A/Users/cg/.vscode/extensions/ms-python.python-2020.6.91350/out/datascience-ui/notebook/vendors~nteract_transforms.bundle.js:2:12015)
    at Ta (vscode-resource://file///c%3A/Users/cg/.vscode/extensions/ms-python.python-2020.6.91350/out/datascience-ui/notebook/commons.initial.bundle.js:2:2379474)
    at Pa (vscode-resource://file///c%3A/Users/cg/.vscode/extensions/ms-python.python-2020.6.91350/out/datascience-ui/notebook/commons.initial.bundle.js:2:2382396)
    at vscode-resource://file///c%3A/Users/cg/.vscode/extensions/ms-python.python-2020.6.91350/out/datascience-ui/notebook/commons.initial.bundle.js:2:2395476
    at Object.t.unstable_runWithPriority (vscode-resource://file///c%3A/Users/cg/.vscode/extensions/ms-python.python-2020.6.91350/out/datascience-ui/notebook/commons.initial.bundle.js:2:25151)
    at Ms (vscode-resource://file///c%3A/Users/cg/.vscode/extensions/ms-python.python-2020.6.91350/out/datascience-ui/notebook/commons.initial.bundle.js:2:2395410)
    at xs (vscode-resource://file///c%3A/Users/cg/.vscode/extensions/ms-python.python-2020.6.91350/out/datascience-ui/notebook/commons.initial.bundle.js:2:2395186)
    at Es (vscode-resource://file///c%3A/Users/cg/.vscode/extensions/ms-python.python-2020.6.91350/out/datascience-ui/notebook/commons.initial.bundle.js:2:2394531)
    at ms (vscode-resource://file///c%3A/Users/cg/.vscode/extensions/ms-python.python-2020.6.91350/out/datascience-ui/notebook/commons.initial.bundle.js:2:2393552)

输出

用户属于实验组“ShowPlayIcon - start”</p>

用户属于实验组“ShowExtensionSurveyPrompt - 已启用”</p>

用户属于实验组“DebugAdapterFactory - 实验”</p>

用户属于实验组“PtvsdWheels37 - 实验”</p>

用户属于实验组“UseTerminalToGetActivatedEnvVars - 控制”</p>

用户属于实验组“LocalZMQKernel - 控制”</p>

用户属于实验组“CollectLSRequestTiming - 控制”</p>

用户属于实验组“CollectNodeLSRequestTiming - 实验”</p>

用户属于实验组“EnableIPyWidgets - 实验”</p>

用户属于实验组“DeprecatePythonPath - control”</p>

用户属于实验组“RunByLine - 控制”</p>

用户属于实验组“CustomEditorSupport - 控制”</p>

康达--版本

pyenv 根目录

python3.7 c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import sys;print(sys.executable)”</p>

python3.6 c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import sys;print(sys.executable)”</p>

python3 c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import sys;print(sys.executable)”</p>

python2 c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import sys;print(sys.executable)”</p>

python c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import sys;print(sys.executable)”</p>

py -3.7 c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import sys;print(sys.executable)”</p>

py -3.6 c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import sys;print(sys.executable)”</p>

py -3 c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import sys;print(sys.executable)”</p>

py -2 c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import sys;print(sys.executable)”</p>

~\anaconda3\envs\viz2\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import sys;print(sys .executable)”</p>

Python 解释器路径:~\anaconda3\envs\viz2\python.exe

启动 Microsoft Python 语言服务器。

~\miniconda3\Scripts\conda.exe 信息 --json

~\miniconda3\Scripts\conda.exe 信息 --json

~\miniconda3\Scripts\conda.exe 环境列表

~\miniconda3\Scripts\conda.exe 信息 --json

~\Anaconda3\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “import jupyter”</p>

~\Anaconda3\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py -c “导入笔记本”</p>

~\Anaconda3\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py jupyter kernelspec --version

~\Anaconda3\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon - v

~\Anaconda3\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon - v

~\Anaconda3\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py vscode_datascience_helpers.daemon --daemon-module=vscode_datascience_helpers.jupyter_daemon - v

~\Anaconda3\python.exe(守护进程)-m jupyter notebook --no-browser --notebook-dir=C:\Users\cg\AppData\Local\Temp\26614261-c8ea-450c-9926-d75a7af2814a --config =C:\Users\cg\AppData\Local\Temp\26614261-c8ea-450c-9926-d75a7af2814a\jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0

~\Anaconda3\python.exe (守护进程) -m jupyter kernelspec list --json

~\Anaconda3\python.exe (守护进程) -m jupyter kernelspec list --json

~\miniconda3\Scripts\conda.exe 环境列表

~\Anaconda3\python.exe(守护进程)c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\vscode_datascience_helpers\getJupyterKernels.py

~\Anaconda3\python.exe(守护进程)c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\vscode_datascience_helpers\getJupyterKernels.py

~\Anaconda3\python.exe(守护进程)c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\vscode_datascience_helpers\getServerInfo.py

~\Anaconda3\python.exe(守护进程)c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\vscode_datascience_helpers\getServerInfo.py

~\Anaconda3\python.exe(守护进程)c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\vscode_datascience_helpers\getServerInfo.py

~\Anaconda3\python.exe(守护进程)c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\vscode_datascience_helpers\getServerInfo.py

~\anaconda3\envs\viz2\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py c:\Users\cg.vscode\ extensions\ms-python.python-2020.6.91350\pythonFiles\normalizeForInterpreter.py “import bokeh, holoviews as hv # noqa”</p>

~\anaconda3\envs\viz2\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py c:\Users\cg.vscode\ extensions\ms-python.python-2020.6.91350\pythonFiles\normalizeForInterpreter.py “将面板导入为 pn”</p>

~\anaconda3\envs\viz2\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py c:\Users\cg.vscode\ extensions\ms-python.python-2020.6.91350\pythonFiles\normalizeForInterpreter.py “来自 bokeh.sampledata.iris 导入花”</p>

~\anaconda3\envs\viz2\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py c:\Users\cg.vscode\ extensions\ms-python.python-2020.6.91350\pythonFiles\normalizeForInterpreter.py “import hvplot.streamz # noqa”</p>

~\anaconda3\envs\viz2\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py c:\Users\cg.vscode\ extensions\ms-python.python-2020.6.91350\pythonFiles\normalizeForInterpreter.py “import hvplot.pandas # noqa”</p>

~\anaconda3\envs\viz2\python.exe c:\Users\cg.vscode\extensions\ms-python.python-2020.6.91350\pythonFiles\pyvsc-run-isolated.py c:\Users\cg.vscode\扩展\ms-python.python-2020.6.91350\pythonFiles\normalizeForInterpreter.py "flowers.hvplot.bivariate(x='sepal_width', y='sepal_length', width=600, groupby='species')" ~\miniconda3 \Scripts\conda.exe 信息 --json

4

1 回答 1

0

从该示例代码中,我通过以下方式使其工作:

hvplot.plot(flowers, x="sepal_width", y="sepal_length", width=600, groupby="species", kind="scatter" )
于 2020-07-08T16:43:49.963 回答