You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(base) fatli@fatli:~$ conda list
# packages in environment at /anaconda3:## Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py37_0
alabaster 0.7.12 py37_0
# 省略……
(base) fatli@fatli:~$ python
Python 3.7.3 (default, Mar 27 2019, 16:54:48)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license"for more information.
>>> exit()
(base) fatli@fatli:~$ anaconda-navigator
/anaconda3/lib/python3.7/site-packages/anaconda_navigator/api/conda_api.py:1364: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
# 省略……
zsh
三项验证都失败。
➜ /Users/fatli > conda list
zsh: command not found: conda
➜ /Users/fatli > python
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license"for more information.
>>> exit()
➜ /Users/fatli > anaconda-navigator
zsh: command not found: anaconda-navigator
➜ /Users/fatli >export PATH="/anaconda3/bin:$PATH"# 导入Anaconda路径后,3项验证成功。然而每次新建终端(zsh模式下)都要导入一次。
此时可能:conda will not modify your shell scripts at all. In order to initialize after the installation process is done, first run source<path to conda>/bin/activate and then run conda init.
Tip: You can abbreviate many frequently used command options that are preceded by 2 dashes (--) to just 1 dash and the first letter of the option. So --name and -n are the same, and --envs and -e are the same.
# 激活环境
conda activate myenv
# 停用环境(Conda从系统命令中删除当前活动环境的路径名)
conda deactivate
# "conda activate" and "conda deactivate" only work on conda 4.6 and later versions.# For conda versions prior to 4.6, run: "source activate" or "source deactivate"
# 查看环境信息
conda info --envs # 或者使用:conda env list# conda environments:#
base * /anaconda3
myenv /anaconda3/envs/myenv
# 安装非conda包(使用pip安装软件包)# 如果无法从conda或Anaconda.org获得软件包,可以使用其它软件包管理器(如pip)查找并安装软件包# 以安装软件包see为实例:
conda install see
PackagesNotFoundError: The following packages are not available from current channels:
conda search see
PackagesNotFoundError: The following packages are not available from current channels
conda search --override-channels --channel defaults see
PackagesNotFoundError: The following packages are not available from current channels
# 使用pip查找并安装软件包
pip search see
pip install see
# 注意:使用conda create --name myenv创建的干净的环境(不安装任何软件包),没有安装pip,需要手动安装pip# 否则将会使用系统默认的pip进行安装软件包
conda install pip # 安装最新版本的pip及其依赖,并安装最新的Python版本# 验证安装
conda list | grep see
see 1.4.1 pypi_0 pypi
开发环境:
一、安装Anaconda
1. 安装Anaconda
安装 Anaconda ,使用图形化(非命令行)界面安装即可,也是官方推荐的安装方式。
2. 验证安装
conda list
(新建或重启终端后,conda
才会生效。)python
。此命令运行Python shell。如果安装并运行Anaconda,它启动时显示的版本信息将包括“Anaconda”。要退出Python shell,请输入命令quit()
。anaconda-navigator
。如果Anaconda安装正确,将打开图形程序Anaconda Navigator。3. bash/zsh 切换
bash 切换到 zsh (一般要新建或重启终端后才生效):
(base) fatli@fatli:~$ chsh -s /bin/zsh
zsh 切换到 bash (前提是已经安装zsh,一般要新建或重启终端后才生效):
➜ /Users/fatli > chsh -s /bin/bash
~
目录是你当前的用户目录(/Users/username
),这里是/Users/fatli
。/
目录是根目录。根目录是 Uers 目录的上一级目录。bash
zsh
原因:安装 Anaconda 时,默认将 Anaconda 的 bin 路径安装到 bash 模式下,可见
~/.bash_profile
文件。zsh模式下,不能验证 Anaconda 的解决方案:在
~/.zshrc
文件下添加 Anaconda 路径:此时可能:conda will not modify your shell scripts at all. In order to initialize after the installation process is done, first run
source<path to conda>/bin/activate
and then runconda init
.附:
(base)
出现在Terminal提示符前完成以上配置后,
(base)
可能会默认出现在 Terminal 命令提示符前,如下:(base) ➜ /Users/fatli >
这有可能是因为
auto_activate_base
被设置为True
导致的,可以通过以下命令查看并进行修改:此时重新打开 Terminal ,命令提示符前的
(base)
便会消失。二、conda管理环境
Conda 是一个开源包管理系统和环境管理系统,可在 Windows,macOS 和 Linux 上运行。Conda 可以快速安装,运行和更新软件包及其依赖项。Conda 可以轻松地在本地计算机上的环境之间创建,保存,加载和切换。它是为 Python 程序创建的,但它可以为任何语言打包和分发软件。
Anaconda 包含 1500+ 的 Python / R 数据科学包。这些包一部分已经内置安装,如 beautifulsoup4 ;一部分需要
$ conda install PACKAGENAME
手动安装,如 Scrapy 。参考:https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
三、conda管理Python
参考:https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-python.html
# 查看可用的Python版本 conda search python
四、conda管理包
参考:https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-pkgs.html
The text was updated successfully, but these errors were encountered: