设置pyenv时,找不到eval命令 [英] While setting up pyenv, getting eval command not found

查看:48
本文介绍了设置pyenv时,找不到eval命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所述,我正在设置pyenv以在我的朋友Mac上的帐户上运行python 3.8.5.我认为问题出在我的〜/.zshrc文件中

  echo -e'if命令-v pyenv 1>/dev/null 2>& 1;然后\ n eval"$(pyenv init-)" \ nfi'>〜/.zshrc 

到目前为止,我已经检查了$ PATH命令以确保该命令和export命令没有问题,但是还不能解决该问题.还尝试在bash shell中使用上述命令,最后使用〜/.bash_profile仍然不起作用.由于所有权问题,我无法运行brew bash或brew zsh.

我正在关注

更新2:

解决方案

在评论中进行了很多讨论之后,我们发现了几个间距问题:缺少空格,并且一个空格是不间断空格而不是普通空格.:

  |失踪v vecho -e'if命令-v pyenv 1>/dev/null 2>& 1;然后\ n eval"$(pyenv init-)" \ nfi'>>〜/.zshrc^|不间断 

不间断的空间特别棘手,因为它在视觉上与普通空间没有区别.通过 LC_ALL=C cat -v 管道文件使其可见为M-BM-".

注意:至少在macOS的美式键盘上,键入Option-space可以输入一个不间断的空格.他们通常会被错误输入,因为在键入假定为正常的空格时,由于某些原因,Option键被按下.

编辑.zshrc文件以添加缺少的空格并删除固定的不间断空格.

顺便说一句,我要在这里添加一个寓意:准确键入 matters ,当您拥有文本源时,通常最好粘贴并粘贴而不是尝试准确地重新键入内容.

As title stated I'm setting up pyenv to run python 3.8.5 on my account on my friend Mac. The issues I believe is coming from this command in my ~/.zshrc file

echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval"$(pyenv init-)"\nfi' >>~/.zshrc

So far I have check the $PATH command to ensure nothing is wrong with that and export command but haven't been able to fix the issue. Also tried using the above command in bash shell with the ~/.bash_profile at the end still doesn't work. I'm unable to run brew bash or brew zsh due to ownership issues.

I'm following this guide to set it up if that help.

updated:screenshot

Updated 2:

解决方案

After much discussion in the comments, we found several spacing problems: there were missing spaces, and one space that was a non-breaking space rather than a plain space:

                                                          |   missing   |
                                                          v             v
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >>~/.zshrc
                                                     ^
                                                     | non-breaking

The non-breaking space is particularly tricky, since it's visually indistinguishable from a normal space. Piping the file through LC_ALL=C cat -v made it visible as "M-BM- ".

Note: at least on the US keyboard on macOS, typing Option-space enters a non-breaking space. They usually get entered by mistake because the Option key was down for some reason when a supposed-to-be-normal space was typed.

Editing the .zshrc file to add the missing spaces and remove the non-breaking space fixed it.

BTW, I'll add a moral here: exact typing matters, and when you have a text source it's usually better to copy-and-paste rather than trying to retype something accurately.

这篇关于设置pyenv时,找不到eval命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆