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 fileecho -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval"$(pyenv init-)"\nfi' >>~/.zshrcSo 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:screenshotUpdated 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 vecho -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >>~/.zshrc ^ | non-breakingThe 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命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-18 13:32
查看更多