为了在vscode中启动tensorboard,我执行了以下步骤:
Python:Launch TensorBoard
然后我得到了一个错误:
We failed to start a TensorBoard session due to the following error: Command failed: conda activate ldl && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/cxy/.vscode-server/extensions/ms-python.python-2022.18.2/pythonFiles/printEnvVariables.py
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If your shell is Bash or a Bourne variant, enable conda for the current user with
$ echo ". /home/cxy/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc
or, for all users, enable conda with
$ sudo ln -s /home/cxy/anaconda3/etc/profile.d/conda.sh /etc/profile.d/conda.sh
The options above will permanently enable the 'conda' command, but they do NOT
put conda's base (root) environment on PATH. To do so, run
$ conda activate
in your terminal, or to put the base environment on PATH permanently, run
$ echo "conda activate" >> ~/.bashrc
Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
your ~/.bashrc file. You should manually remove the line that looks like
export PATH="/home/cxy/anaconda3/bin:$PATH"
^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
我已经尝试了建议的命令,即echo ". /home/cxy/anaconda3/etc/profile.d/conda.sh" >> ~/.bashrc
,但是它不起作用,我仍然得到相同的错误。
我该如何解决这个问题?有什么建议吗?提前谢谢!
发布于 2022-12-03 15:39:17
我已经解决了这个问题!
基本上,它是由vscode中Python和Pylance扩展的最新版本引起的,我们所要做的就是简单地降低这两个扩展的级别,并确保vscode不会自动更新它们。
因此,做以下几点:
Python extension
和Pylance extension
降级为耳机版本,比如v2021.10.xx和v2021.10.0 .auto update
,以确保在重新启动vscode后step1中的下行代码工作。具体来说,打开Settings
并搜索关键字update
,执行以下操作:
2.1。在Update: Mode
下面,选择None
而不是default
2.2。在All extensions
下面,选择None
而不是None
在我完成上述步骤之后,问题就消失了。然后,我可以通过shift+cmd+P
启动张力板,并选择Python:Launch TensorBoard
。
https://stackoverflow.com/questions/74644326
复制相似问题