当前位置:网站首页>Uses of Anacoda
Uses of Anacoda
2022-08-01 21:35:00 【Programmer Awei】
前言
一般来说,We all install a certain version on our computerpython的解释器,Then I usually use this interpreter when writing code,Then there will be a bad place,That there will be a third party library version conflict issues,试想一下,If you are writing two projects using the same one on your computerpython解释器,Then if your two projects must use a certain version of the library when using a certain library,This is bound to cause conflict.
解决方法1
使用pycharmcreate a virtual environment

首先呢,这个是不推荐的,为啥呢?很简单,This creates a virtual environment based on the installation on your computerpython解释器,Based on this interpreter,Create a virtual environment for your project,Although the problem of package conflict is solved,但是呢,Anyone with project experience should know,每个项目的pythonversion will be different,And sometimes you have to use a specific version to not report an error,使用pycharmThe created virtual environment can isolate the dependencies of the project though,但是无法解决python版本问题,I can't always install another version on my computer every time I make a projectpython吧,费力!
解决方法2
The installation process is not described(略)~
基于Anacoda创建的虚拟环境,virtual environmentpython版本,and also isolates a virtual environment for you,这样的话,As long as I make a project in the future, I will create a version of the projectpython,And the package that the relevant version depends on can be.
安装完Anaconda以后,我们会有一个Anaconda Prompt的命令窗口,where we can use commands to complete a series of operations.例如,创建一个虚拟环境test
conda create -n test python=3.9测试,可以看到Anaconda本身的python版本是3.6

Now I activate the newly createdtest虚拟环境
conda activate test再次测试

So where exactly is the virtual environment we created?,我们找到自己安装的Anaconda目录,找到一个vens的文件夹,It is what we create a virtual environment.auto是默认的

PyChram中使用Anaconda
Now that the virtual environment is created,那我们就要使用,一般使用pycharm进行开发,所以要在pychram中使用创建好的虚拟环境.
例子:We have a project here,需要的python版本是3.9(not installed on the computer)
具体操作:
1.使用Anaconda创建一个python版本3.9的虚拟环境.
2.解压项目,在pycharm中打开.
3.Created virtual environment for project configuration.
使用Anaconda创建一个python版本3.9的虚拟环境.
conda create -n amazon_qt python=3.9
解压项目,在pycharm中打开

Created virtual environment for project configuration.




找到Anaconda安装目录,Add the virtual environment directory you createdpython解释器


使用成功!
使用terminal查看一下python版本

常用conda命令
包管理命令
# 列出当前环境下所有安装的 conda 包.
$ conda list
# 列举一个指定环境下的所有包
$ conda list -n env_name
# 查询库
$ conda search scrapys
# 安装库安装时可以指定版本例如:(scrapy=1.5.0)
$ conda install scrapy
# 为指定环境安装某个包
$ conda install --name target_env_name package_name
# 更新安装的库
$ conda update scrapy
# 更新指定环境某个包
$ conda update -n target_env_name package_name
# 更新所有包
$ conda update --all
# Deleting installed libraries doesn't work either(conda uninstall)
$ conda remove scrapy
# 删除指定环境某个包
$ conda remove -n target_env_name package_name
# 删除没有用的包
$ conda clean -p
环境命令
# 查看现有的环境
$ conda info --env
# 创建环境,后面的python=3.6是指定python的版本
$ conda create --name env_name python=3.6
# 创建包含某些包的环境(也可以加上版本信息)
$ conda create --name env_name python=3.7 numpy scrapy
# 激活某个环境
$ activate env_name
# 关闭某个环境
$ conda deactivate env_name
# 复制某个环境
$ conda create --name new_env_name --clone old_env_name
# 删除某个环境
$ conda remove --name env_name --all
# 生成需要分享环境的yml文件(需要在虚拟环境中执行)
$ conda env export > environment.yml
# 别人在自己本地使用yml文件创建虚拟环境
$ conda env create -f environment.yml
边栏推荐
- C pitfalls and pitfalls Chapter 7. Portability pitfalls 7.10 Free first, then realloc
- AIDL通信
- LeetCode
- Spark集群搭建
- C Expert Programming Chapter 1 C: Through the Fog of Time and Space 1.3 The Standard I/O Library and the C Preprocessor
- Spark shuffle调优
- P7215 [JOISC2020] 首都 题解
- 【力扣】字符串相乘
- 2022牛客多校联赛第五场 题解
- Day33 LeetCode
猜你喜欢

scikit-learn no moudule named six

Image fusion GANMcC study notes

Interview Blitz 70: What are sticky packs and half packs?How to deal with it?

FusionGAN:A generative adversarial network for infrared and visible image fusion文章学习笔记

File operations of WEB penetration

WEB渗透之SQL 注入

基于php酒店在线预定管理系统获取(php毕业设计)

用户量大,Redis没法缓存响应,数据库宕机?如何排查解决?

The difference between groupByKey and reduceBykey

牛血清白蛋白-葡聚糖-叶黄素纳米颗粒/半乳糖白蛋白磁性阿霉素纳米粒的制备
随机推荐
FusionGAN:A generative adversarial network for infrared and visible image fusion article study notes
图片识别商品接口 API:天猫淘宝
JVM内存结构详解
【Jmeter常用断言组件】
C陷阱与缺陷 附录B Koenig和Moo夫妇访谈
C专家编程 第1章 C:穿越时空的迷雾 1.2 C语言的早期体验
LeetCode
Port protocol for WEB penetration
TP5-NPs负载噻吩类化合物TP5白蛋白纳米粒/阿魏酸钠新糖牛血清蛋白纳米粒
Graph adjacency matrix storage
空间数据库开源路,超图+openGauss风起禹贡
C pitfalls and pitfalls Chapter 8 Suggestions and answers 8.2 Answers
Record the first PR to an open source project
图像融合GANMcC学习笔记
pytest:开始使用
AIDL通信
方舟生存进化是什么游戏?好不好玩
C语言_联合体共用体引入
基于php在线学习平台管理系统获取(php毕业设计)
包含吲哚菁绿的多聚体白蛋白纳米球/载马钱子碱纳米粒的牛血清白蛋白微球的制备