python - 使用 Anaconda 安装 Python 环境
问题描述
我刚刚尝试使用终端使用 Home-brew 安装 Anaconda,并收到以下消息:
L-MBP:agda-stdlib le$ brew install conda
Updating Homebrew...
Error: No available formula with the name "conda"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.
L-MBP:agda-stdlib le$ brew install anaconda
Error: No available formula with the name "anaconda"
Found a cask named "anaconda" instead. Try
brew cask install anaconda``
L-MBP:agda-stdlib le$ brew cask install anaconda
==> Caveats
Cask anaconda installs files under /usr/local. The presence of such
files can cause warnings when running `brew doctor`, which is considered
to be a bug in Homebrew Cask.
...
installation finished.
==> Changing ownership of paths required by anaconda; your password may be necessary
anaconda was successfully installed!
L-MBP:agda-stdlib le$ conda create --name snakes python=3.7.2
-bash: conda: command not found
L-MBP:agda-stdlib le$ conda -bash: conda: command not found
当我尝试打开 anaconda 并尝试创建 Python 环境时,我收到消息“找不到命令”。
问题是什么?
解决方案
通过 Homebrew 安装 anaconda
brew cask
通过执行安装 anaconda
➜ brew cask install anaconda (or)
➜ brew install --cask anaconda [Newer versions of Homebrew]
.
.
.
PREFIX=/usr/local/anaconda3
.
.
.
anaconda was successfully installed!
让我们运行 jupyter notebook
尝试jupyter notebook
在您的终端中执行。
这不起作用……为什么?因为我们的 shell 不知道 anaconda 文件夹在哪里,所以让我们将该文件夹添加到我们的 shell 路径中。
设置环境路径。
在文件顶部下方插入一行, ~/.zshrc
因为当您尝试在终端上执行 python 时,它会先在文件夹 /usr/local/anaconda3/bin 上搜索,然后再搜索默认操作系统路径,这意味着您可以执行 jupyter notebook 和 python 。
export PATH="/usr/local/anaconda3/bin:$PATH"
重新启动终端或使用source ~/.zshrc
重新加载您的 shell 环境并执行 jupyter notebook 输出将是这样的
推荐阅读
- ios - 删除等宽约束并调整按钮大小
- php - Slim Respect 验证问题
- c# - 更改在 ListBox WindowsForm C# 中选择的颜色行项目
- php - 选择一个选择框空白另一个选择框
- spring - ShinyProxy 和 Google 身份验证错误 404
- ruby-on-rails - Ruby on Rails 应用程序:ElasticSearch 错误“type”=>“cluster_block_exception”
- excel-formula - 第三列单元格应该是excel第一列和第二列中两个数字的乘积
- jquery - 单击子菜单时将类添加到父菜单
- apache-spark - 使用 MapType 列的 Spark Parquet 性能
- xpath - xPath 表达式获取主题标签的 Instagram 帖子总数