Anaconda·

计算机的本质就是虚拟(封装)、分层

https://anaconda.org.cn/

Anaconda 个人版是一个免费、易于安装的包管理器、环境管理器和 Python 发行版,包含 1,500 多个开源包,并提供 免费社区支持。Anaconda 与平台无关,因此无论您在 Windows、macOS 还是 Linux 上都可以使用它。

Anaconda与conda、pip与conda的区别

Anaconda是一个软件发行版。软件发行版是一个预先建立和配置好的packages的集合,可以被安装在操作系统上,并被使用。Anaconda是由Anaconda公司开发的,一个包含PyData生态中的核心软件的完全发行版,它包含了Python本身和数百个第三方开源项目的二进制文件,例如conda、numpy、scipy、ipython等。

Conda是一个包和环境管理工具。包管理工具是一个用来自动化安装、升级、删除packages的工具。由于Conda拥有“conda install“、”conda update“、”conda remove“等子命令,它完全符合包管理工具的定义。

Conda是一个包管理器;Anaconda才是一个python发行版。关于conda和anaconda不可不知的误解和事实——conda必知必会

pip和anaconda冲突 有点担心哈哈

1
2
3
4
5
6
7
8
9
10
11
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
查看虚拟环境
conda env list
创建虚拟环境
conda create -n test python==3.7.0
激活虚拟环境
conda activate test
进入后可以下载第三方库(pip下载pandas需要numpy,发现已下载,不管numpy版本问题,但库更多;conda下载会考虑兼容性)
pip install pandas -i https://pypi.tuna.tsinghua.edu.cn/simple

在刚开始接触Python这门编程语言的时候众多Python的编辑器难免让人眼花缭乱。如果你想用Pyhton学习基础语法、数据分析以及可视化和机器学习,那么jupyter notebook完全可以作为你首选的考虑工具。这款编辑器的交互式体验非常好,你可 以做到一行代码一个输出,同时你的一些分析结果以及可视化图表也可以保存下 来。

首先创建虚拟环境,这里我创建一 个test的虚拟环境Python版本选择3.7,如果已创好虚拟环境可以直接进入准备安装 jupyter notebook的环境中(Anaconda的base环境下自带jupyter notebook)

pip install jupyter==1.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple http://mirrors.aliyun.com/pypi/simple/

1
2
3
4
5
6
7
>pip install jupyter==1.0.0 -i http://mirrors.aliyun.com/pypi/simple/
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
ERROR: Could not find a version that satisfies the requirement jupyter==1.0.0 (from versions: none)
ERROR: No matching distribution found for jupyter==1.0.0
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
WARNING: There was an error checking the latest version of pip.

解决的代码:pip install jupyter==1.0.0 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

也可参考,知道问题是什么后直接就能搜到博客了,哈哈Windows7 设置pip 镜像 Pip Warning:–trusted-host 问题解决方案 | pip 添加trusted host


以为是pip或镜像源或什么问题

I’m ready to assist you with the Jupyter installation issues. Here’s a breakdown of the errors and potential solutions:

1. Trusted Host Warning:

  • Use HTTPS: If the Aliyun repository supports HTTPS, use https://mirrors.aliyun.com/pypi/simple/ instead.
  • Trust the host (if necessary): If HTTPS isn’t available, add --trusted-host mirrors.aliyun.com to the command.

2. Version Not Found:

  • Check Availability: Ensure jupyter==1.0.0 is available in the chosen repository.
  • Install Latest: If not, consider installing the latest version with pip install jupyter.

3. Check for Network Issues:

  • Internet Connectivity: Verify your internet connection is stable.
  • Proxy Settings: If behind a proxy, configure pip to use it.

4. Upgrade pip:

  • Address pip Warning: Run python -m pip install --upgrade pip to update pip.

Here are the corrected commands based on the potential solutions:

  • Using HTTPS:

    Bash

    1
    pip install jupyter==1.0.0 -i https://mirrors.aliyun.com/pypi/simple/

    Use code with caution. Learn more

    content_copy

  • Trusting the Host (if HTTPS unavailable):

    Bash

    1
    pip install jupyter==1.0.0 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

    Use code with caution. Learn more

    content_copy

  • Installing Latest Version:

    Bash

    1
    pip install jupyter

    Use code with caution. Learn more

    content_copy

Additional Tips:

  • Virtual Environment: Consider using a virtual environment to isolate Jupyter dependencies.
  • Different Repository: If issues persist, try a different repository like pypi.org.

If you encounter further problems, provide more details about your environment (OS, Python version, pip version, etc.) for tailored assistance.


1
2
3
4
5
6
7
8
9
设置自动补全
pip install jupyter_contrib_nbextensions==0.5.1 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
jupyter contrib nbextension install --user --skip-running-check #好家伙这个命令忘输入了,怪不得又不一样,Configurable nbextensions只有几个

调整默认路径
Jupyter notebook --generate-config
Overwrite C:\Users\han\.jupyter\jupyter_notebook_config.py with default config? [y/N]y
Writing default config to: C:\Users\han\.jupyter\jupyter_notebook_config.py
#c.NotebookApp.notebook_dir = ’' ,将你要设定的起始路径添加进去

最后讲述了notebook的一些快捷键

绿色闪烁,单元格内输入模式,ESC蓝色命令行模式,上下,m md格式,y code,a上加单元格

Ctrl+Enter执行


第二节实训讲的是Python语法,没什么值得记的