我最近在我的Mac上安装了anaconda2.默认情况下,Conda配置为在我打开新的终端会话时激活基本环境.
我想要访问Conda命令(即我希望Conda的路径添加到我的$ PATH,Conda在初始化时会这样做,这很好).
但我通常不用python编程,我不希望Conda默认激活环境.
当第一次conda init从提示执行时,Conda将以下内容添加到我的.bash_profile:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/geoff/anaconda2/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/geoff/anaconda2/etc/profile.d/conda.sh" ]; then
. "/Users/geoff/anaconda2/etc/profile.d/conda.sh"
else
export PATH="/Users/geoff/anaconda2/bin:$PATH"
fi
# fi
unset __conda_setup
# <<< conda initialize <<<
Run Code Online (Sandbox Code Playgroud)
如果我注释掉整个块,那么我就无法激活任何Conda环境.
我试图评论整个街区除外
export PATH="/Users/geoff/anaconda2/bin:$PATH"
Run Code Online (Sandbox Code Playgroud)
但是当我开始一个新会话并尝试激活一个环境时,我收到了以下错误消息:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 pyenv 在我的 macbook 中安装较旧的 python 版本 3.6.8。\n不幸的是,我遇到了这个构建 OS X 错误,我无法解决该错误。\n如果有人知道我如何解决这个问题,谢谢。
\n\n(base) \xe2\x9e\x9c ~ pyenv install 3.6.8\npython-build: use openssl@1.1 from homebrew\npython-build: use readline from homebrew\nDownloading Python-3.6.8.tar.xz...\n-> https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz\nInstalling Python-3.6.8...\npython-build: use readline from homebrew\npython-build: use zlib from xcode sdk\n\nBUILD FAILED (OS X 10.14.6 using python-build 20180424)\n\nInspect or clean up the working tree at /var/folders/cn/d7tn5tls0jg6_dyn2853t6p40000gn/T/python-build.20200424220226.47493\nResults logged to /var/folders/cn/d7tn5tls0jg6_dyn2853t6p40000gn/T/python-build.20200424220226.47493.log\n\nLast 10 log lines:\nchecking for --with-universal-archs... no\nchecking MACHDEP... darwin\nchecking for --without-gcc... no\nchecking for --with-icc... no\nchecking for gcc... x86_64-apple-darwin13.4.0-clang\nchecking whether the C compiler works... no\nconfigure: error: …Run Code Online (Sandbox Code Playgroud) 我正在使用 pyenv 来管理 python 安装和虚拟环境。我的 Mac (Catalina) 上安装了多个 python。
\n对于一个项目,我需要 python 3.6。我知道 conda 提供了使用特定 python 版本创建虚拟环境的可能性,但我想尝试 pyenv 来管理不同的 python 安装。
\n我遵循安装指南并遵循基本的git check out步骤(对于 zsh)。
\n安装完成后,我可以.pyenv在我的主目录中找到一切似乎都正常。我使用 pyenv 成功安装了 python 3.6。当我运行pyenv versions以列出所有 python 安装(并切换到 conda 安装作为测试)时,输出不包含任何原始 python 安装(请参阅上面的列表)。输出:
\xe2\x96\xb6 pyenv versions\n* system (set by /Users/DVerb5/.pyenv/version)\n …Run Code Online (Sandbox Code Playgroud)