我使用homebrew安装了pyenv,但当我尝试使用以下命令激活pyenv时:
pyenv shell 3.8.3,
我得到以下消息:
pyenv: shell integration not enabled. Run `pyenv init' for instructions.
所以我运行:
pyenv init
然后它会说:“
# Load pyenv automatically by appending # the following to ~/.zshrc: eval "$(pyenv init -)
我不知道怎么做,any1知道怎么做吗?我运行的是mac os High Sierra 10.13.6
最终,我想使用Python 3.7.4,这就是我安装pyenv的原因。如果我键入
pyenv global 3.7.4
到我得到的命令行中
pyenv: version `3.7.4' not installed
但我确实安装了python 3.7.4。如果我键入
python -V
在命令行中,我得到了Python 3.8.3。如何安装python3.7.4,这样pyenv就可以看到它了。还需要注意的是,我在使用bash时遇到了一些问题,我必须在b4中输入:
PATH=/Users/myHomepage/opt/anaconda3/bin:$PATH
之前激活我的虚拟环境。
我看过一个关于如何为多个Python设置pyenv的教程,其中他说我们必须在我们的bash配置文件中添加设置,才能输入以下三个命令:
$ echo ‘export PYENV_ROOT=“$HOME/.pyenv”’ >> ~/.bash_profile
$ echo 'export PATH=“$PYEN_ROOT/bin:$PATH” >>.bash.profile
$ echo ‘eval “$(pyenv init -)”’ >>~/.bash_profile
但我使用的是zsh,所以我输入:
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
我只在zsh下运行了这两个命令,我不知道这是否是我重启zsh时收到错误消息的原因:
[oh-my-zsh] Insecure completion-dependent directories detected:
drwxrwxr-x 3 myHomepage admin 102 Oct 7 20:04 /usr/local/share/zsh
drwxrwxr-x 4 myHomepage admin 136 Oct 7 20:26 /usr/local/share/zsh/site-functions
[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.
[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
➜ ~ exec "$SHELL"
[oh-my-zsh] Insecure completion-dependent directories detected:
drwxrwxr-x 3 myHomepage admin 102 Oct 7 20:04 /usr/local/share/zsh
drwxrwxr-x 4 myHomepage admin 136 Oct 7 20:26 /usr/local/share/zsh/site-functions
[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.
[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
所以我输入了:
compaudit | xargs chmod g-w,o-w
但还是得到了:
There are insecure directories:
因此,我在命令行中放入以下代码:
exec "$SHELL"
然后我将python 3.7.4安装到我的文件夹项目中,它似乎可以工作,但我不确定错误消息“有不安全的目录:”
发布于 2020-10-08 13:09:44
在您的示例中,您引用了在bash配置文件配置文件中运行的3个命令。您说您正在使用zsh,但只显示了前两个命令。您是否对zsh配置文件运行3命令?像这样:
$ echo 'eval "$(pyenv init -)"' >> ~/.zshrc
https://stackoverflow.com/questions/64255254
复制相似问题