Haskell Stack 找不到 PATH 因为 conda 也安装了

发布于 2025-01-10 11:04:09 字数 2158 浏览 0 评论 0原文

我在大学学习 Haskell Stack。我的 $PATH 遇到了问题。据我所知,因为我还安装了 conda。我正在做什么,我已经安装了 Haskell Stack 并按照说明设置项目:

stack new MyFirstProject
cd MyFirstProject
stack build  
stack install 

一切正常,直到 stack install 我收到错误:

Copying from /Users/jamesmurphy/modules/Functional_Programming/Week5/MyFirstProject/.stack-work/install/x86_64-osx/cc05e4baf51e8b4a394e9151b943fe70c815c04c30f6eb1688f4a9e027d758ca/8.10.7/bin/MyFirstProject-exe to /Users/jamesmurphy/.local/bin/MyFirstProject-exe

Copied executables to /Users/jamesmurphy/.local/bin:
- MyFirstProject-exe

Warning: Installation path /Users/jamesmurphy/.local/bin
         not found on the PATH environment variable.

我检查了 $PATH 以查看它的设置使用 nano .bash_profile 及其设置,因为

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/jamesmurphy/opt/anaconda3/bin/conda' 'shell.bash' 'hoo$
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/jamesmurphy/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/jamesmurphy/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/jamesmurphy/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

我对此有点迷失,因为我以前从未见过这样的 $PATH 。

因此,我尝试使用 nano .bash_profile 添加到此 $PATH 并将其添加到顶部。

export PATH="$PATH:/Users/jamesmurphy/.local/bin:$PATH"

仍然无法工作,所以我只是将所有 conda 内容替换为

export PATH="$PATH:/Users/jamesmurphy/.local/bin:$PATH"

我需要添加此 PATH,但也不知道使用 conda 内容执行此操作的正确方法。我已经尝试过几次不同的事情,但无法弄清楚。每次进行更改时,我都会打开一个新终端。如果有人可以帮助我或为我指明正确的方向,我将不胜感激。谢谢

更新

抱歉我可能遗漏了信息。 “堆栈安装”应该生成程序的可执行文件。 Haskel Stack 已经正确安装。如果我运行

/Users/jamesmurphy/modules/Functional_Programming/Week5/MyFirstProject/.stack-work/install/x86_64-osx/cc05e4baf51e8b4a394e9151b943fe70c815c04c30f6eb1688f4a9e027d758ca/8.10.7/bin/MyFirstProject-exe 

它就会运行该程序。我被告知将 /Users/jamesmurphy/.local/bin 添加到我的 $PATH 但当我这样做时它仍然不起作用。

I'm learning Haskell Stack in college. I've hit a problem with my $PATH. From what I can tell is because I also have conda installed. What I'm doing, I've installed Haskell Stack fine and follow the directions to set up project:

stack new MyFirstProject
cd MyFirstProject
stack build  
stack install 

All fine until stack install I get the error:

Copying from /Users/jamesmurphy/modules/Functional_Programming/Week5/MyFirstProject/.stack-work/install/x86_64-osx/cc05e4baf51e8b4a394e9151b943fe70c815c04c30f6eb1688f4a9e027d758ca/8.10.7/bin/MyFirstProject-exe to /Users/jamesmurphy/.local/bin/MyFirstProject-exe

Copied executables to /Users/jamesmurphy/.local/bin:
- MyFirstProject-exe

Warning: Installation path /Users/jamesmurphy/.local/bin
         not found on the PATH environment variable.

I checked the $PATH to see what it was set to using nano .bash_profile and its set as

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/jamesmurphy/opt/anaconda3/bin/conda' 'shell.bash' 'hoo$
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/jamesmurphy/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/jamesmurphy/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/jamesmurphy/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

I'm a bit lost with this as I've never seen $PATH like this before.

So I have tried adding to this $PATH by using nano .bash_profile and added this to the top.

export PATH="$PATH:/Users/jamesmurphy/.local/bin:$PATH"

Still wont work, So I Just replaced all the conda stuff with

export PATH="$PATH:/Users/jamesmurphy/.local/bin:$PATH"

I need to add this PATH but don't know the right way to do it with the conda stuff also. I've messed around with a few times trying a couple of different things and cant figure it out. I opened a new terminal every time I made a change. If anyone can help me or point me in the right direction, it would be most appreciated. Thank you

Updated

Sorry I might have left info out. The 'stack install' is suppose to make an executable file of the program. Haskel Stack is in installed correctly already. If I run

/Users/jamesmurphy/modules/Functional_Programming/Week5/MyFirstProject/.stack-work/install/x86_64-osx/cc05e4baf51e8b4a394e9151b943fe70c815c04c30f6eb1688f4a9e027d758ca/8.10.7/bin/MyFirstProject-exe 

it will run the program. I'm being told to add /Users/jamesmurphy/.local/bin to my $PATH but when I do this it still doesn't work.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文