简体   繁体   English

我已经安装了 MSYS2 和 Anaconda3,那么如何在 MSYS2 上使用 conda?

[英]I have installed MSYS2 and Anaconda3, then how can I use conda on MSYS2?

I want to complie a fortran file on Win10, just like python3 -m numpy.f2py -c -m h3plus h3plus.f90我想在 Win10 上编译一个 fortran 文件,就像python3 -m numpy.f2py -c -m h3plus h3plus.f90
But python in MSYS2 doesn't contain NumPy, so I try to use conda, but I don't know how to use conda on MSYS2.但是MSYS2中的python不包含NumPy,所以我尝试使用conda,但是我不知道如何在MSYS2上使用conda。

If you don't have anaconda/miniconda already installed on your windows machine, do that by downloading the proper windows installer.如果您的 windows 机器上尚未安装 anaconda/miniconda,请下载正确的 windows 安装程序。

If conda is already installed on the windows side, all you have to do is initialize conda for MSYS2's bash.如果 conda 已经安装在 windows 端,你所要做的就是为 MSYS2 的 bash 初始化 conda。 To do this, edit .bash_profile and append something like the following:为此,请编辑.bash_profile和 append ,如下所示:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
eval "$('/c/Users/John/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
# <<< conda initialize <<<

Make sure you replace the path on the 3rd line with the path to conda.exe on your machine.确保将第 3 行的路径替换为机器上conda.exe的路径。 After that close and reopen your MSYS2 terminals.之后关闭并重新打开您的 MSYS2 终端。

If you're using a shell other than bash, you can inspect the output of conda init --all --dry-run --verbose in order to find the corresponding init script.如果您使用的是 shell 而不是 bash,您可以检查 conda 命令的conda init --all --dry-run --verbose以在脚本中找到对应的它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM