Python _Anaconda軟體安裝及Jupyter Notebook操作筆記




距離上次安裝使用ANACONDA已經相隔7年了> ~ < |||

安裝上一些步驟都有一些連結失效等問題

最近修學分班剛好又要接觸到此工具
















Spyder就是Anaconda安裝完後附帶的IDE






Spyder我們點RUN綠色撥放就可執行程式
預設會把每次這個變數宣告相關暫存到所謂IPython環境裏頭(記憶體會keep住)

測試小範例
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""

import numpy as np
a = np.array([1,2,3,4])
print(a)

b = 1
c=3.14


Jupyter Notebook操作筆記


預設在C槽做程式應用開發建置
若想更換路徑可以
開啟cmd之後cd指定目錄在下jupyter notebook指令
要注意此terminal的process若中斷則notebook瀏覽器預設開啟的也會掛掉




notebook不僅可寫程式還能做筆記

你可新增一個程式檔案


你每執行一行按上面RUN即可
基本上由上至下scan只要在同一個文檔程式中定義
生命週期就同一個可識別的到之前前面宣告過的變數
相比Spyder美中不足之處就是沒有語法自動跳出來提示以及變數側欄可去檢視目前存於記憶體中宣告了多少捨麼型別的變數
要自己print出來查看


要注意的一點就是你每打一行都會寫入存至ipynb文檔中
以下是其存入的內容
  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
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "cd9377aa",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 2 3 4]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "a = np.array([1,2,3,4])\n",
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "48a49b1d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[1 2 3 4]\n"
     ]
    }
   ],
   "source": [
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "2ca5657e",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'b' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[3], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[38;5;28mprint\u001b[39m(b)\n",
      "\u001b[1;31mNameError\u001b[0m: name 'b' is not defined"
     ]
    }
   ],
   "source": [
    "print(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "51a52297",
   "metadata": {},
   "outputs": [],
   "source": [
    "b=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "6ec9c44c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n"
     ]
    }
   ],
   "source": [
    "print(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4decb067",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}




留言

這個網誌中的熱門文章

何謂淨重(Net Weight)、皮重(Tare Weight)與毛重(Gross Weight)

Architecture(架構) 和 Framework(框架) 有何不同?_軟體設計前的事前規劃的藍圖概念

經得起原始碼資安弱點掃描的程式設計習慣培養(五)_Missing HSTS Header