powershell - 如何同时激活 Anaconda 环境和 Typescript 观察者?
问题描述
"terminal.integrated.shellArgs.windows": [
"-ExecutionPolicy", "ByPass", "-NoExit", "-Command", "& 'C:/Users/Marko/anaconda3/shell/condabin/conda-hook.ps1' ; conda activate 'C:/Users/Marko/anaconda3'"
]
我把上面的内容放在我的 VS Codesettings.json
文件中。这会导致 Powershell 启动,就好像我-ExecutionPolicy ByPass -NoExit -Command "& 'C:\Users\Marko\anaconda3\shell\condabin\conda-hook.ps1' ; conda activate 'C:\Users\Marko\anaconda3' "
作为参数传入它一样。这本身就可以很好地工作,但是我正在使用 Typescript 中的 VS Code 扩展,当我运行它时,它会尝试启动 Typescript 观察程序并且我收到以下错误。
> Executing task: & 'c:\Users\Marko\Source\Repos\The Spiral Language\VS Code Plugin\node_modules\.bin\tsc.cmd' -p 'c:\Users\Marko\Source\Repos\The Spiral Language\VS Code Plugin\tsconfig.json' --watch <
At line:1 char:113
+ ... k.ps1' ; conda activate 'C:/Users/Marko/anaconda3' -Command & 'c:\Use ...
+ ~
The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : AmpersandNotAllowed
当 PS 在没有激活 Anaconda 的参数的情况下启动时,这可以正常工作。是否可以调整我的设置以便 Anaconda 和 TS watcher 都可以启动?
解决方案
在这里查看答案。只需运行conda init
即可设置 Anaconda 环境在 Powershell 启动时初始化。
推荐阅读
- ios - 如何在swift ios中创建指定的数据结构?
- javascript - 在打字稿中实现安全导航
- css - 在 div 中水平居中文本
- java - 滚动项目时,Android ListView Adapter 会改变颜色
- plsql - 将小数作为 SQL 函数参数传递时出现数值或估值错误
- selenium - OWASP ZAP - 使用 Selenium Python 启动浏览器后提取 URL
- php - whatsapp api在php密码创建错误中发送消息
- c++ - C++ 中的方括号和对类型
- c++ - 三参数函数模板混淆示例
- bash - 如何使用 sed 用空格代替 LF,而不是 CRLF?