栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

常用的一些小指令(备忘)

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

常用的一些小指令(备忘)

常用的一些小指令(备忘)
  • 一、Anaconda
    • 1.1创建环境基本操作
    • 1.2 添加源
  • 二、linux实用命令
    • 2.1 requirements.txt

一、Anaconda 1.1创建环境基本操作
// 查看现有环境
conda info --env
// 创建环境
conda create --name env_name python=3.6  //python版本需要在此指定
// 进入环境
conda activate env_name 
// 删除环境
conda env remove -n env_name
// 退出环境
conda deactivate
// 安装包
conda install xxxx
pip install xxxx
// 查看某个环境内的包
conda list //需要先进入此环境
1.2 添加源
// 清华源
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/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

conda config --set show_channel_urls yes
// 中科大源
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/

conda config --set show_channel_urls yes
二、linux实用命令 2.1 requirements.txt

在查看别人的Python项目时,经常会看到一个requirements.txt文件,里面记录了当前程序的所有依赖包及其精确版本号。这个文件有点类似与Rails的Gemfile。其作用是用来在另一台PC上重新构建项目所需要的运行环境依赖。

// 生成requirements.txt文件(二选其一)
pip freeze > requirements.txt
conda list -e > requirements.txt
// 安装requirements.txt文件(二选其一)
pip install -r requirements.txt 
conda install --yes --file requirements.txt
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/330982.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号