当前位置:网站首页>Some experience of using D2L package and related environment configuration
Some experience of using D2L package and related environment configuration
2022-07-24 05:26:00 【Xinxin vegetation】
One introduction
written :
Beginners of deep learning
Students who lack experience in environmental error troubleshooting
Teacher Li Mu B Station machine learning course ,dive into deep learning Website Students who study for textbooks
following :
All the thunder I stepped on , Also spent a lot of time in troubleshooting mistakes , Gained some experience
I use cpu Version of pytorch
Many pits have been sorted out , Also added some own analysis , I hope I can help you
Two About anaconda Configuration of
1 anaconda Installation process
Be careful
1 It's best to install Do not install directly to c disc ( If c If the disk space is not rich )
Because it will get bigger , By the time I reinstalled the system 50g It's big
2 When installing, add a to the environment variable (add to path) You'd better check , Otherwise, it may be added to the environment variable later , A little bit of trouble
2 d2l Bao He pytorch Package download
1 Create a new environment
It's best not to put all the necessary bags directly in base In the environment
You can create a new environment
Create command :
conda create -n newd2l python=3.7
newd2l : The name of this environment is newd2l , Readers can change
py=3.7 : Created python The version is 3.7
d2l : Here is l It's lowercase l , No 1
Tips : python It is best to 3.7 edition , I installed 3.6 Version of , Some code doesn't work ( Because there are updates ) , debug Long time
example 1 I am 3.6 Received in grad can be implicitly created only for scalar outputs The error of , however 3.7 Can run
example 2 pip install d2l To search the d2l yes 0.17.0 Version of , Not what you need 0.17.5 Version of , There are some incompatibilities
2 Add image source
Why add an image source ?
anaconda Our server is out of the country , The download speed in China is very slow and even the download chain is broken
Using the image source can download faster and more stable
1 . to conda Add image source
According to the path , find This computer - C disc - user - Your account name - .condarc file
If not , Create a new one yourself .condarc file , The file name is empty , Just one .condarc suffix 
Open it in Notepad mode
Copy and paste the following code to set up the image source
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- http://pypi.douban.com/simple/
- defaults
show_channel_urls: true
Here added 3 Image source , You can find another image source and paste it in the above format
If you can't change the suffix
Try the following 
The above settings are applicable conda install command To download the package
2 . to pip Add image source
stay This computer - C disc - user - Your account name Create a folder pip Folder
stay pip Create in a folder pip.ini file 
Notepad mode opens
Assign and paste the following code
[global]
index-url = https://pypi.mirrors.ustc.edu.cn/simple/
extra-index-url = https://pypi.mirrors.ustc.edu.cn/simple/
https://mirrors.aliyun.com/pypi/simple/
https://pypi.tuna.tsinghua.edu.cn/simple/
http://pypi.mirrors.ustc.edu.cn/simple/
https://pypi.org/simple/
trusted-host = pypi.mirrors.ustc.edu.cn
pypi.mirrors.ustc.edu.cn
mirrors.aliyun.com
pypi.tuna.tsinghua.edu.cn
pypi.mirrors.ustc.edu.cn
pypi.org
index-url Is to set the image source Multiple image sources are set above
trusted-host Set up trust for these websites
The above settings are applicable pip install command To download the package
3 . If you are surfing the Internet in science
You can choose Temporarily turn off scientific Internet , If you insist
It also needs to be Setting up a proxy server
1 stay .condarc file Add to
proxy_servers:
http: http://127.0.0.1:7893
https: http://127.0.0.1:7893
ssl_verify: false
Here 7893 Change it to your port name
2 stay pip.info file Add to
proxy = http://127.0.0.1:7893
As shown in the figure below

3 d2l Bao He pytorch Package download
1 open anaconda prompt
2 Switch to directory 2 .2.1 The new environment you created in 
3 Input pip install d2l
And then wait , If you encounter a choice yes or no , Input y , Hit enter
Wait for it to download and install 
Now? d2l 0.17.5 It's already installed
4 pytorch Installation
If you are installing cpu edition Of torch , Input
conda install pytorch torchvision torchaudio cpuonly -c pytorch
that will do 
If you are installing gpu edition Of torch , Step link
https://zh-v2.d2l.ai/chapter_installation/index.html
If you have any questions, please check the comment area and search by yourself
( recommend : gpu More appropriate
I am shy in my pocket , Unable to replace the old computer , No, NVIDIA The graphics card , Helpless use cpu edition )
3 kaggle
Treasure website that provides free computing power
The code on my computer appears due to the version bug But I can't find the reason ,
I temporarily used this website for code running training
How to be in kaggle How to import the required packages ? for example d2l?
Just type in
!pip install d2l
Click on the run , You can do it d2l Download this package 
If you are a computer with low configuration , You can also run the code here 
边栏推荐
猜你喜欢
随机推荐
Hotel IPTV digital TV system solution
用双向链表实现栈(C)
Career planning route
利用二分法从数组中寻找具体数值
Integration of SSM
泛型和注解
Read "effective managers - Drucker"
C语言从入门到入土(三)
generator生成器,只生成两个方法
jdbc封装一个父类减少代码重复
Learn AI linear regression from Li Mu. The code implementation from scratch is super detailed
reflex
yocs_velocity_smoother源码编译
赶紧进来!!轻松掌握C语言“顺序”、“分支”、“循环”三大结构
Implementation and comparison of nine sorting (ten thousand words summary)
Generator generator, which generates only two methods
【sklearn】数据预处理
好的程序员与不好的程序员
C语言入门篇 五.初识指针 六.初识结构体
Theoretical basis of machine learning









