当前位置:网站首页>Anaconda based module installation and precautions
Anaconda based module installation and precautions
2022-06-25 07:53:00 【Stephen_ Tao】
List of articles
Because my computer was installed with Pycharm and Python, So in the process of programming practice , If Python If the specified module is not installed , You need to go through the command line pip install Mode of installation , Or directly at Pycharm Lower installation . It seems that there is nothing , But the installed modules are basically stored in Python In the catalog site-packages Next , When more and more modules are installed ,site-packages It's going to get bigger and bigger . Because I put Python The installation to C Discoid , So one day I found myself C The plate turns red !!! Later, we investigated the cause , Know is site-packages There are too many modules .
By chance, I learned about it on the Internet Anaconda, Find out Anaconda Contains a large number of science packages , At the same time, you can create a virtual environment , It can switch different environment configurations according to task needs , Very convenient . So I put Python It's off , installed Anaconda, It has also solved the above problems . Below I will summarize the precautions during installation .
1 Anaconda Installation
Anaconda Download address
CSDN There are many detailed installation tutorials on , I feel “ The base QI Study ” This blogger wrote Anaconda install ( The process is detailed ) Very detailed , You can refer to .
1.1 matters needing attention
The following is a combination of my problems in the installation process , Make the following instructions .
- Custom installation path : because C Disk is system disk , So I am D Disk NEW Anaconda Folder , Store the installed files in this folder
- Configuration of environment variables : When I installed it , no choice Add Anaconda3 to my PATH environment variable, So you need to manually configure the environment variables (Anaconda install ( The process is detailed ) It also explains how to configure environment variables ). The meaning of environment variables is to indicate where the important directories of the operating system are ( stay cmd Window , If the system cannot find the specified file in the current directory , It also looks for the file in the corresponding path in the environment variable , If none of them are found , That's what makes a mistake .)
2 Anaconda Virtual environment path modification
2.1 matters needing attention
Get into Anaconda Prompt, Virtual environments can be created through conda create -n “name” python=“version”(name Is the name of the virtual environment ,version yes python Version number of ), In this way, the virtual environment will be created under the default path , The default path can be through conda info How to query , The default path is displayed in envs directories Next ( If I have multiple paths , The first one is the default path ).
Take my computer for example , The default creation path for my virtual environment is C:\Users\top.conda\envs, Therefore, the created virtual environment will be stored in this path .
But my C Disk storage space is running out , So I want to change the path of the virtual environment , The specific modification methods are as follows :
- stay Anaconda type conda info command , Find the configuration file (user config file) Location path
- stay .condarc In file , Enter the modified virtual environment path , The specific form is as follows :
This path can be set according to your needs , I changed the path of the virtual environment to D:\Anaconda\VirEnviroment Next .
3 Anaconda Module installation path modification
Anaconda There are two ways to install modules :
- pip install
- conda install
There are differences between the two installation methods . for instance , I am here D:\Anaconda\VirEnviroment Created a Pytorch Virtual environment for , At this time, I passed through the Anaconda Prompt Type in conda activate Pytorch Activate the environment , here Anaconda Prompt The interface is as follows :
It means that we have entered Pytorch Virtual environment for , The key is coming. !
If I want to install a in this virtual environment pytorch My bag , There are two ways . - The first way is pip install pytorch. here pytorch The package of will be directly downloaded to... Under the current virtual environment path site-packages Next .
- The second way is to use conda install pytorch( Maybe not this order , But it doesn't matter ). Then the system will go to the default path first ( The default path is different from the path of the virtual environment ) I'm looking for pytorch Related to the package , If any , Will pytoych Copy related packages to the current virtual environment path site-packages in . If the relevant package cannot be found in the default path , Then it will download in the default path first pytorch My bag , Then copy the package to the current virtual environment site-packages in .
3.1 matters needing attention
In my computer ,conda install The default path for is in C In the middle of the plate ( The default path is through conda info Medium package cache get ), My virtual environment is in D Plate , If I want to download a module that I didn't have before , Need to be in C Disk to create a , Then copy it to D Make an order , In view of my C Limited disk capacity , I changed the default path . The modification method is similar to that of the virtual environment :
- stay .condarc In file , Enter the modified default installation path , The specific form is as follows :
I was in D The disk creates a separate pkg The file is used to store the installed package , You can choose the right path according to your needs .
4 And Pycharm The combination of
It's hard to always write code in the command line window , utilize Pycharm Integrated development environment , Can provide many conveniences . The specific steps are as follows :
- stay Pycharm Create a project in
- choice File-Settings-Python Interpreter
- According to the package on which the current project depends , In a specific virtual environment python.exe Add the path of , Click on the app ( The following figure shows that I created a torch_test The engineering of , rely on Pytorch This virtual environment , So I will Pytorch In this virtual environment python.exe The path is added )
notes : there Pytorch It's just the name of a virtual environment , No Pytorch modular
边栏推荐
- Vscode is good, but I won't use it again
- What are the problems with traditional IO? Why is zero copy introduced?
- SCM Project Training
- VSCode很好,但我以后不会再用了
- What are the benefits of reserving process edges for PCB production? 2021-10-25
- Share the process requirements for single-layer flexible circuit board
- C# 读取web上的xml
- Bicubic difference
- Modular programming of wireless transmission module nRF905 controlled by single chip microcomputer
- 50 pieces of professional knowledge of Product Manager (IV) - from problem to ability improvement: amdgf model tool
猜你喜欢
OpenCV每日函数 结构分析和形状描述符(8) fitLine函数 拟合直线
[distillation] pointdistiller: structured knowledge distillationwards efficient and compact 3D detection
基于STM32MP157调试MIPI-DSI屏幕
Take you through the normalization flow of GaN
微信小程序开通客服消息功能开发
Do you know why the PCB produces tin beads? 2021-09-30
【深度学习 轻量型backbone】2022 EdgeViTs CVPR
Anaconda navigator启动慢的一个解决方法
Application of point cloud intelligent drawing in intelligent construction site
三台西门子消防主机FC18配套CAN光端机进行光纤冗余环网组网测试
随机推荐
Knowledge sharing 𞓜 conventional laminated structure of six layer PCB
navicat定时任务无效
C#中如何调整图像大小
PCB board design - automatic layout 2021-10-15
Four software 2021-10-14 suitable for beginners to draw PCB
Do you know why the PCB produces tin beads? 2021-09-30
挖掘微生物暗物质——新思路
产品经理专业知识50篇(四)-从问题到能力提升:AMDGF模型工具
【论文学习】《VQMIVC》
Find out what informatization is, and let enterprises embark on the right path of transformation and upgrading
Sword finger offer II 027 Palindrome linked list
Linux上oracle和mysql的启动,关闭,重启
國外LEAD域名郵箱獲取途徑
饮食干预减轻癌症治疗相关症状和毒性
2160. minimum sum of the last four digits after splitting
基于Anaconda的模块安装与注意事项
c# winform panel自定义图片和文字
传统的IO存在什么问题?为什么引入零拷贝的?
1742. maximum number of small balls in the box
微信小程序入门记录