广告不存在

conda常见命令

2021-05-21 18:49:55      索炜达电子      6266     

conda是一种python环境管理程序,conda和anaconda一起能解决很多环境、包管理的问题。而且安装anaconda的过程中会一并安装scipy,numpy等很多常用的包,可以说是用python进行科学计算和数据分析的必备神器,没用过的同学还不快去体验一下。本文总结了一下conda的常见命令


查询完整帮助文件

conda create --help or conda create -h 其实“--”参数一般都有简写。


管理conda和anaconda

conda info 查询conda信息

conda update conda 升级conda

conda update anaconda 升级anaconda


管理环境

conda info -e 环境信息

conda create -n test python=2.7 创建环境test,并指定python版本,此例为2.7

source activate test 激活环境

source deactivate test 关闭环境

conda remove --name test --all 删除环境


包管理

conda list 列出所有安装的包的信息

conda search beautiful-soup 查询包

conda install -n test beautiful-soup 安装包,并指定安装环境,如果没有-n test,则安装到当前环境

conda update beautiful-soup 升级包

conda remove -n test beautiful-soup 移除包


这就是最常用的conda命令


图形界面——anaconda-navigator

当然有人不喜欢用命令行,那我推荐你用anaconda-navigator,conda install anaconda-navigator 即可安装,使用十分简单,自己摸索即可,推荐新手使用!

-i https://mirror.baidu.com/pypi/simple

注意:conda 和 pip 之类包管理或者 virtualenv 之类虚拟环境管理软件不要一同使用。用conda就只用conda,否则容易出错,切记。


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 --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

conda config --set show_channel_urls yes

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

conda activate

============

TypeError: Descriptors cannot not be created directly.

If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.

If you cannot immediately regenerate your protos, some other possible workarounds are:

 1. Downgrade the protobuf package to 3.20.x or lower.

 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

============

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple protobuf==3.19.0

TAGconda
广告不存在