-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path新手如何使用anaconda(python)—简单介绍.html
784 lines (570 loc) · 26.3 KB
/
新手如何使用anaconda(python)—简单介绍.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="keywords" content="python,matlab,yolo,yolov3,java,go,c++,c#" />
<meta name="description" content="孙全胜의Space" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<title>
新手如何使用anaconda(python)—简单介绍 | 孙全胜의Space
</title>
<meta name="generator" content="hexo-theme-ayer">
<link rel="shortcut icon" href="/bitbug_favicon.ico" />
<link rel="stylesheet" href="/dist/main.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css">
<link rel="stylesheet" href="/css/custom.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/pace.min.js"></script>
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-168079169-1', 'auto');
ga('send', 'pageview');
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?6101cdb197f4b6300cb90fa7e51accec";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<link rel="alternate" href="/atom.xml" title="孙全胜의Space" type="application/atom+xml">
</head>
</html>
<body>
<canvas width="1777" height="841" style="position: fixed; left: 0px; top: 0px; z-index: 999; pointer-events: none;"></canvas>
<div id="app">
<main class="content on">
<section class="outer">
<article id="post-新手如何使用anaconda(python)—简单介绍" class="article article-type-post" itemscope
itemprop="blogPost" data-scroll-reveal>
<div class="article-inner">
<header class="article-header">
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
新手如何使用anaconda(python)—简单介绍
</h1>
</header>
<div class="article-meta">
<a href="/%E6%96%B0%E6%89%8B%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8anaconda%EF%BC%88python%EF%BC%89%E2%80%94%E7%AE%80%E5%8D%95%E4%BB%8B%E7%BB%8D.html" class="article-date">
<time datetime="2020-06-17T02:39:27.000Z" itemprop="datePublished">2020-06-17</time>
</a>
<div class="article-category">
<a class="article-category-link" href="/categories/python/">python</a> / <a class="article-category-link" href="/categories/python/%E5%85%A5%E9%97%A8/">入门</a>
</div>
<div class="word_count">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="ri-quill-pen-line"></i>
<span class="post-meta-item-text"> 字数统计:</span>
<span class="post-count">464</span>
</span>
</span>
<span class="post-time">
|
<span class="post-meta-item-icon">
<i class="ri-book-open-line"></i>
<span class="post-meta-item-text"> 阅读时长≈</span>
<span class="post-count">1 分钟</span>
</span>
</span>
</div>
</div>
<div class="article-entry" itemprop="articleBody">
<p>我之前用 python 的 IDLE 去写代码,但是在深度学习的部分,代码频频报错,因为 python 的很多库都没有,而自己去下载的话速度极其的慢。</p>
<p>所以下载 anaconda 了, anaconda 里已经下载了很多库(虽然依然没有我想要的库),但相比单单一个 python 软件便好用许多。</p>
<p>这里介绍一下新手如何快速使用 anaconda(我也是刚接触 python,好在比C简单多了,和 matlab 又很像):</p>
<a id="more"></a>
<p>我们在:</p>
<p>清华镜像下载 anaconda(下载过程看我另一篇博文):<br><a href="https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/" target="_blank" rel="noopener">https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/</a></p>
<p>安装好了之后</p>
<p><img src="https://img-blog.csdnimg.cn/20200217161343829.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ1NTA0MTE5,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p>
<p>开始界面应该有这些东西,不过我们需要的一般只有 Jupyter Notebook 和 Anaconda Prompt。</p>
<p>Jupyter Notebook 可以当作 python 来用,只是界面不同。 Anaconda Prompt 就是和windows 的 cmd 差不多。</p>
<p><img src="https://img-blog.csdnimg.cn/20200217162002355.png" alt="在这里插入图片描述"></p>
<p>在prompt里输入python,则就会显示python的版本,我这里是3.6.5。</p>
<p>并进入python的编程环境:</p>
<p><img src="https://img-blog.csdnimg.cn/20200217163039966.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ1NTA0MTE5,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p>
<p>不过最好不要在这里写代码吧,因为…上图就是教训呀!(新手不懂。。。)</p>
<p>回归正题:<br>代码一般都在Jupyter Notebook里写<br>这里打开Jupyter Notebook</p>
<p><img src="https://img-blog.csdnimg.cn/2020021716330039.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ1NTA0MTE5,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"><br><img src="https://img-blog.csdnimg.cn/20200217163404727.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ1NTA0MTE5,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p>
<p>电脑会自动打开网页 jupyter , anaconda中的python就是个web程序。在这里就可以开始python之旅了。上图现实的打开文件路径,可以打开里面储存的文件。</p>
<p><img src="https://img-blog.csdnimg.cn/20200217164043772.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ1NTA0MTE5,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p>
<p>点击new按钮就可以创建新的text file 和folder.</p>
<p>打开text:</p>
<p><img src="https://img-blog.csdnimg.cn/2020021716452081.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ1NTA0MTE5,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述">就可以编辑文字和代码。</p>
<p>点击 python 3 就可以正常的进行代码的编写了,下面随手写了个新手代码,按住shift+Enter就可以运行代码了。</p>
<p><img src="https://img-blog.csdnimg.cn/20200217165201133.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ1NTA0MTE5,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p>
<p>我也是个新手,因为 MATLAB 项目的需要所以转战 python。</p>
<p>接下来我会继续更新 MATLAB 项目的部分,也会开始python爬虫的编写。</p>
<p>欢迎各位指正错误。</p>
<!-- reward -->
</div>
<!-- copyright -->
<div class="declare">
<ul class="post-copyright">
<li>
<i class="ri-copyright-line"></i>
<strong>版权声明: </strong>
本博客所有文章除特别声明外,著作权归作者所有。转载请注明出处!
</li>
</ul>
</div>
<footer class="article-footer">
<div class="share-btn">
<span class="share-sns share-outer">
<i class="ri-share-forward-line"></i>
分享
</span>
<div class="share-wrap">
<i class="arrow"></i>
<div class="share-icons">
<a class="weibo share-sns" href="javascript:;" data-type="weibo">
<i class="ri-weibo-fill"></i>
</a>
<a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
<i class="ri-wechat-fill"></i>
</a>
<a class="qq share-sns" href="javascript:;" data-type="qq">
<i class="ri-qq-fill"></i>
</a>
<a class="douban share-sns" href="javascript:;" data-type="douban">
<i class="ri-douban-line"></i>
</a>
<!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
<i class="icon icon-qzone"></i>
</a> -->
<a class="facebook share-sns" href="javascript:;" data-type="facebook">
<i class="ri-facebook-circle-fill"></i>
</a>
<a class="twitter share-sns" href="javascript:;" data-type="twitter">
<i class="ri-twitter-fill"></i>
</a>
<a class="google share-sns" href="javascript:;" data-type="google">
<i class="ri-google-fill"></i>
</a>
</div>
</div>
</div>
<div class="wx-share-modal">
<a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
<p>扫一扫,分享到微信</p>
<div class="wx-qrcode">
<img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://squansh.top/%E6%96%B0%E6%89%8B%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8anaconda%EF%BC%88python%EF%BC%89%E2%80%94%E7%AE%80%E5%8D%95%E4%BB%8B%E7%BB%8D.html" alt="微信分享二维码">
</div>
</div>
<div id="share-mask"></div>
<ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/anaconda/" rel="tag">anaconda</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/python/" rel="tag">python</a></li></ul>
</footer>
</div>
<nav class="article-nav">
<a href="/%E4%BD%BF%E7%94%A8MATLAB%E8%B0%83%E7%94%A8%E6%91%84%E5%83%8F%E5%A4%B4%E5%B9%B6%E6%8B%8D%E7%85%A7%E2%80%94%E8%AF%A6%E7%BB%86%E4%BB%A3%E7%A0%81.html" class="article-nav-link">
<strong class="article-nav-caption">上一篇</strong>
<div class="article-nav-title">
使用MATLAB调用摄像头并拍照—详细代码
</div>
</a>
<a href="/Anaconda%E9%95%9C%E5%83%8F%E4%B8%8B%E8%BD%BD%E5%9C%B0%E5%9D%80.html" class="article-nav-link">
<strong class="article-nav-caption">下一篇</strong>
<div class="article-nav-title">Anaconda镜像下载地址</div>
</a>
</nav>
<!-- valine评论 -->
<div id="vcomments-box">
<div id="vcomments">
</div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/Valine.min.js'></script>
<script>
new Valine({
el: '#vcomments',
app_id: 'bMSQYcOX9RQgHRwGmc2xl2iY-9Nh9j0Va',
app_key: 'fhWrk4asGBlMT45CQdjPoEx4',
path: window.location.pathname,
notify: true,
verify: true,
avatar: 'monsterid',
placeholder: '给我的文章加点评论吧~',
recordIP: true
});
const infoEle = document.querySelector('#vcomments .info');
if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
infoEle.childNodes.forEach(function (item) {
item.parentNode.removeChild(item);
});
}
</script>
<style>
#vcomments-box {
padding: 5px 30px;
}
@media screen and (max-width: 800px) {
#vcomments-box {
padding: 5px 0px;
}
}
#vcomments-box #vcomments {
background-color: #fff;
}
.v .vlist .vcard .vh {
padding-right: 20px;
}
.v .vlist .vcard {
padding-left: 10px;
}
</style>
</article>
</section>
<footer class="footer">
<div class="outer">
<ul>
<li>
<span id="timeDate">载入天数...</span><span id="times">载入时分秒...</span>
<script>
var now = new Date();
function createtime() {
var grt= new Date("06/01/2020 00:00:00");//在此处修改你的建站时间,格式:月/日/年 时:分:秒
now.setTime(now.getTime()+250);
days = (now - grt ) / 1000 / 60 / 60 / 24; dnum = Math.floor(days);
hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math.floor(hours);
if(String(hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
mnum = Math.floor(minutes); if(String(mnum).length ==1 ){mnum = "0" + mnum;}
seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
snum = Math.round(seconds); if(String(snum).length ==1 ){snum = "0" + snum;}
document.getElementById("timeDate").innerHTML = "本站已安全运行 "+dnum+" 天 ";
document.getElementById("times").innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒";
}
setInterval("createtime()",250);
</script>
</li>
</ul>
<ul>
<li>
Copyrights ©
2020
<i class="ri-heart-fill heart_icon"></i> squansh
</li>
</ul>
<ul>
<li>
<span>
<span><i class="ri-user-3-fill"></i>访问人数:<span id="busuanzi_value_site_uv"></span></s>
<span class="division">|</span>
<span><i class="ri-eye-fill"></i>浏览次数:<span id="busuanzi_value_page_pv"></span></span>
</span>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
</li>
</ul>
<ul>
</ul>
<ul>
<li>
<!-- cnzz统计 -->
<script type="text/javascript" src="https://s4.cnzz.com/z_stat.php?id=1278953980&web_id=1278953980"></script>
</li>
</ul>
</div>
</footer>
<div class="float_btns">
<div class="totop" id="totop">
<i class="ri-arrow-up-line"></i>
</div>
<div class="todark" id="todark">
<i class="ri-moon-line"></i>
</div>
</div>
</main>
<aside class="sidebar on">
<button class="navbar-toggle"></button>
<nav class="navbar">
<div class="logo">
<a href="/"><img src="/images/photo_side.svg" alt="孙全胜의Space"></a>
</div>
<ul class="nav nav-main">
<li class="nav-item">
<a class="nav-item-link" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="/archives">Archives</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="/categories/">Categories</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="/tags">Tags</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="https://changyuqi.top/" target="_blank" rel="noopener">Sister</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="http://121.41.228.97/" target="_blank" rel="noopener">Bolo</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="https://quan_sheng_sun.gitee.io/resume" target="_blank" rel="noopener">Resume</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="https://jq.qq.com/?_wv=1027&k=KyptBBmy" target="_blank" rel="noopener">Qgroup</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="https://www.zhihu.com/people/jes331" target="_blank" rel="noopener">Zhi-h</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="https://weibo.com/5600672195" target="_blank" rel="noopener">Wei-b</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="https://blog.csdn.net/qq_45504119" target="_blank" rel="noopener">CSDN</a>
</li>
<li class="nav-item">
<a class="nav-item-link" href="mailto:[email protected]">E-mail</a>
</li>
</ul>
</nav>
<nav class="navbar navbar-bottom">
<ul class="nav">
<li class="nav-item">
<a class="nav-item-link nav-item-search" title="搜索">
<i class="ri-search-line"></i>
</a>
<a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
<i class="ri-rss-line"></i>
</a>
</li>
</ul>
</nav>
<div class="search-form-wrap">
<div class="local-search local-search-plugin">
<input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
<div id="local-search-result" class="local-search-result"></div>
</div>
</div>
<script type="text/javascript" src="//rf.revolvermaps.com/0/0/8.js?i=5uyif1eoo9j&m=0&c=ff0000&cr1=ffffff&f=arial&l=33&s=341&bv=85" async="async"></script>
</aside>
<!--浏览器搞笑标题-->
<script type="text/javascript" src="/js/FunnyTitle.js"></script>
<script>
if (window.matchMedia("(max-width: 768px)").matches) {
document.querySelector('.content').classList.remove('on');
document.querySelector('.sidebar').classList.remove('on');
}
</script>
<div id="mask"></div>
<!-- #reward -->
<div id="reward">
<span class="close"><i class="ri-close-line"></i></span>
<p class="reward-p"><i class="ri-cup-line"></i></p>
<div class="reward-box">
</div>
</div>
<script src="/js/jquery-2.0.3.min.js"></script>
<script src="/js/lazyload.min.js"></script>
<!-- Subtitle -->
<script>
try {
var typed = new Typed("#subtitle", {
strings: ['夜深了', '是否明天会悄然忘记', '夜却深了'],
startDelay: 0,
typeSpeed: 400,
loop: true,
backSpeed: 150,
showCursor: true
});
} catch (err) {
console.log(err)
}
</script>
<!-- Tocbot -->
<script src="/js/tocbot.min.js"></script>
<script>
tocbot.init({
tocSelector: '.tocbot',
contentSelector: '.article-entry',
headingSelector: 'h1, h2, h3, h4, h5, h6',
hasInnerContainers: true,
scrollSmooth: true,
scrollContainer: 'main',
positionFixedSelector: '.tocbot',
positionFixedClass: 'is-position-fixed',
fixedSidebarOffset: 'auto'
});
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/jquery.justifiedGallery.min.js"></script>
<script src="/dist/main.js"></script>
<!-- ImageViewer -->
<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
<!-- Background of PhotoSwipe.
It's a separate element as animating opacity is faster than rgba(). -->
<div class="pswp__bg"></div>
<!-- Slides wrapper with overflow:hidden. -->
<div class="pswp__scroll-wrap">
<!-- Container that holds slides.
PhotoSwipe keeps only 3 of them in the DOM to save memory.
Don't modify these 3 pswp__item elements, data is added later on. -->
<div class="pswp__container">
<div class="pswp__item"></div>
<div class="pswp__item"></div>
<div class="pswp__item"></div>
</div>
<!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
<div class="pswp__ui pswp__ui--hidden">
<div class="pswp__top-bar">
<!-- Controls are self-explanatory. Order can be changed. -->
<div class="pswp__counter"></div>
<button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
<button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>
<button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
<button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
<!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
<!-- element will get class pswp__preloader--active when preloader is running -->
<div class="pswp__preloader">
<div class="pswp__preloader__icn">
<div class="pswp__preloader__cut">
<div class="pswp__preloader__donut"></div>
</div>
</div>
</div>
</div>
<div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
<div class="pswp__share-tooltip"></div>
</div>
<button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
</button>
<button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
</button>
<div class="pswp__caption">
<div class="pswp__caption__center"></div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/photoswipe-ui-default.min.js"></script>
<script>
function viewer_init() {
let pswpElement = document.querySelectorAll('.pswp')[0];
let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))
$imgArr.forEach(($em, i) => {
$em.onclick = () => {
// slider展开状态
// todo: 这样不好,后面改成状态
if (document.querySelector('.left-col.show')) return
let items = []
$imgArr.forEach(($em2, i2) => {
let img = $em2.getAttribute('data-idx', i2)
let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
let title = $em2.getAttribute('alt')
// 获得原图尺寸
const image = new Image()
image.src = src
items.push({
src: src,
w: image.width || $em2.width,
h: image.height || $em2.height,
title: title
})
})
var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
index: parseInt(i)
});
gallery.init()
}
})
}
viewer_init()
</script>
<!-- MathJax -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
}
});
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for(i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script>
var ayerConfig = {
mathjax: true
}
</script>
<!-- Katex -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js"></script>
<!-- busuanzi -->
<script src="/js/busuanzi-2.3.pure.min.js"></script>
<!-- ClickLove -->
<script src="/js/clickLove.js"></script>
<!-- ClickBoom -->
<script src="/js/clickBoom.js"></script>
<!-- CodeCopy -->
<link rel="stylesheet" href="/css/clipboard.css">
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
function wait(callback, seconds) {
var timelag = null;
timelag = window.setTimeout(callback, seconds);
}
!function (e, t, a) {
var initCopyCode = function(){
var copyHtml = '';
copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
copyHtml += '</button>';
$(".highlight .code pre").before(copyHtml);
$(".article pre code").before(copyHtml);
var clipboard = new ClipboardJS('.btn-copy', {
target: function(trigger) {
return trigger.nextElementSibling;
}
});
clipboard.on('success', function(e) {
let $btn = $(e.trigger);
$btn.addClass('copied');
let $icon = $($btn.find('i'));
$icon.removeClass('ri-file-copy-2-line');
$icon.addClass('ri-checkbox-circle-line');
let $span = $($btn.find('span'));
$span[0].innerText = 'COPIED';
wait(function () { // 等待两秒钟后恢复
$icon.removeClass('ri-checkbox-circle-line');
$icon.addClass('ri-file-copy-2-line');
$span[0].innerText = 'COPY';
}, 2000);
});
clipboard.on('error', function(e) {
e.clearSelection();
let $btn = $(e.trigger);
$btn.addClass('copy-failed');
let $icon = $($btn.find('i'));
$icon.removeClass('ri-file-copy-2-line');
$icon.addClass('ri-time-line');
let $span = $($btn.find('span'));
$span[0].innerText = 'COPY FAILED';
wait(function () { // 等待两秒钟后恢复
$icon.removeClass('ri-time-line');
$icon.addClass('ri-file-copy-2-line');
$span[0].innerText = 'COPY';
}, 2000);
});
}
initCopyCode();
}(window, document);
</script>
</div>
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"model":{"jsonPath":"/live2dw/assets/haruto.model.json"},"display":{"position":"right","width":260,"height":520},"mobile":{"show":false},"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body>
</html>