Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Pyenv没有接收其他python安装_Python_Zsh_Pyenv - Fatal编程技术网

Pyenv没有接收其他python安装

Pyenv没有接收其他python安装,python,zsh,pyenv,Python,Zsh,Pyenv,我正在使用pyenv管理python安装和虚拟环境。我在Mac(Catalina)上安装了几个python python系统(usr/bin中的python 2.7) usr/bin中的Python3.9(来自python.org/downloads的默认安装程序) python 3.9 in/opt/anaconda3/bin/python3(来自) 对于一个项目,我需要python 3.6。我知道conda提供了使用特定python版本创建虚拟环境的可能性,但我想尝试pyenv来管理不同

我正在使用pyenv管理python安装和虚拟环境。我在Mac(Catalina)上安装了几个python

  • python系统(usr/bin中的python 2.7)
  • usr/bin中的Python3.9(来自python.org/downloads的默认安装程序)
  • python 3.9 in/opt/anaconda3/bin/python3(来自)
对于一个项目,我需要python 3.6。我知道conda提供了使用特定python版本创建虚拟环境的可能性,但我想尝试pyenv来管理不同的python安装

我遵循了基本的git签出步骤(对于zsh)

安装后,我可以在我的主目录中找到
.pyenv
,一切似乎都正常。我使用pyenv成功安装了python3.6。当我运行
pyenv versions
以列出所有python安装(并切换到我的conda安装作为测试)时,输出不包含任何原始python安装(请参见上面的列表)。输出:

▶ pyenv versions
* system (set by /Users/DVerb5/.pyenv/version)
  3.6.12
如何使pyenv也能找到我的其他python安装?我试着做一些研究,这似乎是可能的。我看了下面的两页,看起来很有希望,但没能弄明白

如前所述,我使用zsh,这是我的.zshrc的内容

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/Users/DVerb5/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="avit"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line if pasting URLs and another text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable the auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
    git
    zsh-syntax-highlighting)

ZSH_DISABLE_COMPFIX=true

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

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


alias code="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code"

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi

此外,我还注意到
哪个pyenv
不起作用。它返回以下结果。(我不知道是否相关)


如果您通过pyenv本身安装它,它就会工作。例如,如果您运行
pyenv安装3.7.4
,那么您将获得由pyenv管理的3.7.4。我不知道有什么方法可以让pyenv找到以前安装的版本,但添加新版本确实很容易。

根据您希望pyenv在您的计算机上查找和发现所有Python可执行文件,而不仅仅是它安装的版本,是的,没错(系统Python不是由Pyenv安装的,但是确实出现了,其他的:与Anconda一起提供的Python和另一个“常规”Python安装没有出现)Anaconda可以通过它的常规安装程序安装在任何地方。系统python位于一个相当标准的位置,因此pyenv能够检测到它。如果它扫描了整个文件系统,那么使用
pyenv版本
echo $PATH
/Users/DVerb5/.pyenv/bin:/Users/DVerb5/.pyenv/shims:/Users/DVerb5/.pyenv/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/anaconda3/bin```
▶ which pyenv
pyenv () {
    local command
    command="${1:-}"
    if [ "$#" -gt 0 ]
    then
        shift
    fi
    case "$command" in
        (rehash | shell) eval "$(pyenv "sh-$command" "$@")" ;;
        (*) command pyenv "$command" "$@" ;;
    esac
}