為了將 NAS 直接當成 IOT 主機, 除了安裝 Serial Driver, 若要用 python 進行資料分析, 需要安裝其他 package, 但 Synology NAS 目前無法在終端機下直接呼叫 pip 來進行安裝. 參考這篇的內容, 提到啟用虛擬環境後, 即可使用 pip, 經測試發現此方法雖然可用, 卻無法使用排程來啟動執行python程式. 此篇後段提到使用 curl 來安裝 pip3, 此方法方可排程使用.

先切換至 root 身分:

$ sudo –i

輸入密碼後, 使用 curl 安裝 pip3:

 # curl -k https://bootstrap.pypa.io/get-pip.py | python3

之後會得到警告訊息, 說明 pip, pip3 等之安裝路徑:

WARNING: The scripts pip, pip3 and pip3.5 are installed in '/volume1/@appstore/py3k/usr/local/bin' which is not on PATH.

  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

  WARNING: The scripts easy_install and easy_install-3.5 are installed in '/volume1/@appstore/py3k/usr/local/bin' which is not on PATH.

  Consider adding this directory to PATH or, if you prefer to suppress this warn ing, use --no-warn-script-location.

  WARNING: The script wheel is installed in '/volume1/@appstore/py3k/usr/local/bin' which is not on PATH.

  Consider adding this directory to PATH or, if you prefer to suppress this warn ing, use --no-warn-script-location. 

因為可執行的 script 檔案會在第一行使用 #! 指示使用哪一個命令解譯器, 我想使用 #!/bin/python3, 因此建立 symbolic link:

# ln -s /volume1/@appstore/py3k/usr/local/bin/pip3 /bin/pip3

# ln -s /volume1/@appstore/py3k/usr/local/bin/python3.5 /bin/python3

就可以排程使用了

 

 

arrow
arrow
    全站熱搜

    ghostyguo 發表在 痞客邦 留言(0) 人氣()