Linux命令:Conda激活|猫myfilename.txt

发布于 2025-02-11 01:30:18 字数 319 浏览 2 评论 0原文

我正在学习Linux命令,并尝试在日常软件开发中更多地使用它。

我创建了一个conda环境,并将环境路径存储在txt文件中。 IE myfile.txt。下次,我不需要记住激活环境的路径。它将是conda激活环境_path

我也希望不打开txt文件以复制过去并在一行中完成激活。所以我尝试了conda激活| cat myfilename.txt

但它不起作用。我不确定怎么了。感谢您的一些帮助,谢谢!

I am learning Linux commands and try to use it more in my day to day software development.

I created a conda environment and stored the environment path in a txt file. i.e. myfile.txt. For the next time, I don't need to remember the path to activate the environment. It would be conda activate environment_path

I also want not to open the txt file to copy past and get the activation done in one line. So I tried conda activate | cat myFileName.txt

But it didn't work. I'm not sure what was wrong. Some helps are appreciated, thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一刻暧昧 2025-02-18 01:30:18

我想您正在运行标准bash -shell。

您目前正在做的事情是管道上的管道 conda conda Activate的输出/代码> CAT MyFilename.txt

尝试使用此命令,

conda activate $(cat myFileName.txt)

首先将执行命令cat myfilename.txt,因此使用子壳。
之后,命令conda激活cat myfilename.txt的输出运行。

有关更多信息,请参见

I suppose you are running a standard bash-shell.

What you are currently doing, is pipelining the output of conda activate to cat myFileName.txt.

Try instead this command

conda activate $(cat myFileName.txt)

This will first execute the command cat myFileName.txt and therefore read the content of myFileName.txt, using a subshell.
After that, the command conda activate is run with the output of cat myFileName.txt in place.

For more information see Command Substitution

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文