iT邦幫忙

0

phython 環境建置

1.下載
https://www.python.org/
https://ithelp.ithome.com.tw/upload/images/20190211/20106764eC9lbDTwYq.png
2.安裝
https://ithelp.ithome.com.tw/upload/images/20190211/20106764aQWmDrHxG0.png
https://ithelp.ithome.com.tw/upload/images/20190211/20106764uz1NvzFOWu.png
https://ithelp.ithome.com.tw/upload/images/20190211/201067647Aun2y6cnH.png
https://ithelp.ithome.com.tw/upload/images/20190211/20106764f78ehPdpiu.png
https://ithelp.ithome.com.tw/upload/images/20190211/20106764acZ2Lw29rF.png
測試安裝有沒有問題
https://ithelp.ithome.com.tw/upload/images/20190211/20106764w9bdsNwsy9.pnghttps://ithelp.ithome.com.tw/upload/images/20190211/20106764mAiXWC0ATM.pnghttps://ithelp.ithome.com.tw/upload/images/20190211/20106764fEQ1evqWSb.png
3.測試IDLE
新增記事本,副檔名改為py,滑鼠右鍵Edit with IDLE,輸入
print("Hello, world!")
https://ithelp.ithome.com.tw/upload/images/20190211/20106764UTwI2AkT5e.pnghttps://ithelp.ithome.com.tw/upload/images/20190211/20106764T6l5bkjJcW.pnghttps://ithelp.ithome.com.tw/upload/images/20190211/20106764Mfh4WhgITq.pnghttps://ithelp.ithome.com.tw/upload/images/20190211/20106764lQQl6XcKc8.png

安裝Anaconda

Anaconda官網 https://www.anaconda.com/download/
安裝過程中,出現Advanced Options,兩個勾都打勾。
安裝最後,vscode,可以的話也裝一下。

安裝完成後證,從Windows 開始選單(Start menu)中選擇Anaconda Navigator,如果Navigator 可以打開,表示成功安裝Anaconda

使用

2.打開Anaconda Prompt
https://ithelp.ithome.com.tw/upload/images/20190829/20106764NCFNgcPtBL.png
開啟會像這樣
https://ithelp.ithome.com.tw/upload/images/20190829/20106764sszDfididt.png

3.安裝套件

conda install pandas 

https://ithelp.ithome.com.tw/upload/images/20190829/20106764xVOfMFozWM.png
安裝訊息如下,期間會問是不是要繼續,就輸入"Y"

(base) C:\Users\Users>conda install pandas
Solving environment: done

## Package Plan ##


  environment location: C:\ProgramData\Anaconda3

  added / updated specs:
    - pandas


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    lz4-c-1.8.1.2              |       h2fa13f4_0         217 KB
    libcurl-7.65.3             |       h2a8f88b_0         283 KB
    conda-4.7.11               |           py37_0         3.0 MB
    python-libarchive-c-2.8    |          py37_13          24 KB
    xz-5.2.4                   |       h2fa13f4_4         812 KB
    mkl_fft-1.0.6              |   py37hdbbee80_0         120 KB
    sqlite-3.29.0              |       he774522_0         962 KB
    numpy-1.15.4               |   py37ha559c80_0          36 KB
    cryptography-2.7           |   py37h7a1dbc1_0         564 KB
    libpng-1.6.37              |       h2a8f88b_0         598 KB
    pycurl-7.43.0.3            |   py37h7a1dbc1_0          67 KB
    libssh2-1.8.2              |       h7a1dbc1_0         186 KB
    openssl-1.1.1c             |       he774522_1         5.7 MB
    mkl-2018.0.3               |                1       178.1 MB
    certifi-2019.6.16          |           py37_1         156 KB
    pandas-0.25.1              |   py37ha925a31_0         9.8 MB
    conda-package-handling-1.3.11|           py37_0         280 KB
    libarchive-3.3.3           |       h0643e63_5         1.4 MB
    qt-5.9.7                   |   vc14h73c81de_0        92.3 MB
    curl-7.65.3                |       h2a8f88b_0         122 KB
    numpy-base-1.15.4          |   py37h8128ebf_0         3.9 MB
    krb5-1.16.1                |       hc04afaa_7         819 KB
    zstd-1.3.7                 |       h508b16e_0         536 KB
    ca-certificates-2019.5.15  |                1         166 KB
    ------------------------------------------------------------
                                           Total:       300.0 MB

The following NEW packages will be INSTALLED:

    conda-package-handling: 1.3.11-py37_0
    krb5:                   1.16.1-hc04afaa_7
    libarchive:             3.3.3-h0643e63_5
    lz4-c:                  1.8.1.2-h2fa13f4_0
    python-libarchive-c:    2.8-py37_13
    xz:                     5.2.4-h2fa13f4_4
    zstd:                   1.3.7-h508b16e_0

The following packages will be UPDATED:

    ca-certificates:        2018.03.07-0            --> 2019.5.15-1
    certifi:                2018.8.24-py37_1        --> 2019.6.16-py37_1
    conda:                  4.5.11-py37_0           --> 4.7.11-py37_0
    cryptography:           2.3.1-py37h74b6da3_0    --> 2.7-py37h7a1dbc1_0
    curl:                   7.61.0-h7602738_0       --> 7.65.3-h2a8f88b_0
    libcurl:                7.61.0-h7602738_0       --> 7.65.3-h2a8f88b_0
    libpng:                 1.6.34-h79bbb47_0       --> 1.6.37-h2a8f88b_0
    libssh2:                1.8.0-hd619d38_4        --> 1.8.2-h7a1dbc1_0
    mkl_fft:                1.0.4-py37h1e22a9b_1    --> 1.0.6-py37hdbbee80_0
    numpy:                  1.15.1-py37ha559c80_0   --> 1.15.4-py37ha559c80_0
    numpy-base:             1.15.1-py37h8128ebf_0   --> 1.15.4-py37h8128ebf_0
    openssl:                1.0.2p-hfa6e2cd_0       --> 1.1.1c-he774522_1
    pandas:                 0.23.4-py37h830ac7b_0   --> 0.25.1-py37ha925a31_0
    pycurl:                 7.43.0.2-py37h74b6da3_0 --> 7.43.0.3-py37h7a1dbc1_0
    qt:                     5.9.6-vc14h1e9a669_2    --> 5.9.7-vc14h73c81de_0
    sqlite:                 3.24.0-h7602738_0       --> 3.29.0-he774522_0

The following packages will be DOWNGRADED:

    mkl:                    2019.0-118              --> 2018.0.3-1

Proceed ([y]/n)?


Downloading and Extracting Packages
lz4-c-1.8.1.2        | 217 KB    | #################################### | 100%
libcurl-7.65.3       | 283 KB    | #################################### | 100%
conda-4.7.11         | 3.0 MB    | #################################### | 100%
python-libarchive-c- | 24 KB     | #################################### | 100%
xz-5.2.4             | 812 KB    | #################################### | 100%
mkl_fft-1.0.6        | 120 KB    | #################################### | 100%
sqlite-3.29.0        | 962 KB    | #################################### | 100%
numpy-1.15.4         | 36 KB     | #################################### | 100%
cryptography-2.7     | 564 KB    | #################################### | 100%
libpng-1.6.37        | 598 KB    | #################################### | 100%
pycurl-7.43.0.3      | 67 KB     | #################################### | 100%
libssh2-1.8.2        | 186 KB    | #################################### | 100%
openssl-1.1.1c       | 5.7 MB    | #################################### | 100%
mkl-2018.0.3         | 178.1 MB  | #################################### | 100%
certifi-2019.6.16    | 156 KB    | #################################### | 100%
pandas-0.25.1        | 9.8 MB    | #################################### | 100%
conda-package-handli | 280 KB    | #################################### | 100%
libarchive-3.3.3     | 1.4 MB    | #################################### | 100%
qt-5.9.7             | 92.3 MB   | #################################### | 100%
curl-7.65.3          | 122 KB    | #################################### | 100%
numpy-base-1.15.4    | 3.9 MB    | #################################### | 100%
krb5-1.16.1          | 819 KB    | #################################### | 100%
zstd-1.3.7           | 536 KB    | #################################### | 100%
ca-certificates-2019 | 166 KB    | #################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(base) C:\Users\Users>^A

檢查
打開Anaconda Prompt 輸入 conda list
能看到已安裝的套件
https://ithelp.ithome.com.tw/upload/images/20210728/20106764aU8uJ9JZjt.png
檢查jupyter
https://ithelp.ithome.com.tw/upload/images/20190829/20106764FhIcA9R7RY.png
底下這個不能關掉,如果關掉,jupyter就無法使用了
https://ithelp.ithome.com.tw/upload/images/20200612/20106764vCEM3knOQO.png
https://ithelp.ithome.com.tw/upload/images/20200612/20106764S2XZzqtCwB.png
新增一個檔案
https://ithelp.ithome.com.tw/upload/images/20200612/20106764dpzRx1UkHx.png

https://ithelp.ithome.com.tw/upload/images/20200612/20106764b2JgXwK0QJ.png
檢查pandas
https://ithelp.ithome.com.tw/upload/images/20210728/20106764eHihyZsXB9.png

什麼是pip?
它跟Anaconda一樣,都是安裝套件?!
ref
https://medium.com/python4u/jupyter-notebook%E5%AE%8C%E6%95%B4%E4%BB%8B%E7%B4%B9%E5%8F%8A%E5%AE%89%E8%A3%9D%E8%AA%AA%E6%98%8E-b8fcadba15f

什麼是jupyter?
本來是python編輯器,後來擴充到不限於python
ref
https://medium.com/python4u/jupyter-notebook%E5%AE%8C%E6%95%B4%E4%BB%8B%E7%B4%B9%E5%8F%8A%E5%AE%89%E8%A3%9D%E8%AA%AA%E6%98%8E-b8fcadba15f

ref
https://kopu.chat/2017/01/18/%E4%B8%80%E5%B0%8F%E6%99%82python%E5%85%A5%E9%96%80-part-1/
https://zh.wikipedia.org/wiki/Python


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言