当前位置:网站首页>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
边栏推荐
- Find out what informatization is, and let enterprises embark on the right path of transformation and upgrading
- 基于RBAC 的SAAS系统权限设计
- @Resource和@Autowired注解的不同,为什么推荐@Resource?
- C control refresh
- ts环境搭建
- WinForm实现窗口始终在顶层
- 【Unexpected token o in JSON at position 1出错原因及解决方法】
- Importer des données dans MATLAB
- Summary of small problems in smartbugs installation
- 1464. maximum product of two elements in an array
猜你喜欢

Share the process requirements for single-layer flexible circuit board

navicat定时任务无效

基于RBAC 的SAAS系统权限设计

挖掘微生物暗物质——新思路

基于STM32MP157调试MIPI-DSI屏幕

One "stone" and two "birds", PCA can effectively improve the dilemma of missing some ground points under the airborne lidar forest

搞清信息化是什么,让企业转型升级走上正确的道路

Misunderstanding of switching triode

剑指 Offer II 027. 回文链表

产品经理专业知识50篇(四)-从问题到能力提升:AMDGF模型工具
随机推荐
npm install 报错 : gyp ERR! configure error
Find out what informatization is, and let enterprises embark on the right path of transformation and upgrading
Four software 2021-10-14 suitable for beginners to draw PCB
Audio (V) audio feature extraction
Bicubic difference
Accès à la boîte aux lettres du nom de domaine Lead à l'étranger
opencv最小值滤波(不局限于图像)
PCB board design - automatic layout 2021-10-15
WinForm实现窗口始终在顶层
NSIS silent installation vs2013 runtime
Modular programming of wireless transmission module nRF905 controlled by single chip microcomputer
Linux上oracle和mysql的启动,关闭,重启
VOCALOID笔记
力扣78:子集
Atlas conference vulnerability analysis collection
三台西门子消防主机FC18配套CAN光端机进行光纤冗余环网组网测试
WinForm implementation window is always at the top level
Insert and sort the linked list [dummy unified operation + broken chain core - passive node]
SSL证书免费获取教程
Keil and Proteus joint commissioning