站內搜尋:Yahoo搜尋的結果,如果沒有給完整的網址,請在站內再搜尋一次!

顯示具有 Anaconda3 標籤的文章。 顯示所有文章
顯示具有 Anaconda3 標籤的文章。 顯示所有文章

2021-07-07

修改Anaconda中的Jupyter Notebook預設工作目錄

我使用的Jupyter Notebook是安裝Anaconda時,一併提供的功能。Jupyter Notebook預設的工作目錄是登入者的個人工作目錄,例如:C:\Users\使用者代號

更改Jupyter Notebook預設工作目錄的作法:

  1. 進入Anaconda Prompt (命令提示字元)
  2. 執行 jupyter notebook --generate-config
    設定檔會產生在 C:\Users\使用者代號\.jupyter\jupyter_notebook_config.py
  3. 編輯設定檔jupyter_notebook_config.py
  4. 找到 #c.NotebookApp.notebook_dir = '' 這一行
    拿掉#號,填入預設要開啟的位置,例如:D:\myWorks\HanniDocs\pgmSpaces\pyWorks\jupyter
  5. 修改啟動Jupyter Notebook的捷徑內容
  6. 拿掉 目標(T)  內容中的  "%USERPROFILE%/"
    只留下 C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\cwp.py C:\ProgramData\Anaconda3 C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\Scripts\jupyter-notebook-script.py
  7. 重新執行Jupyter Notebook捷徑,就可以將工作目錄正確的導向指定的位置。





2019-08-17

讓在Anaconda Navigator環境下安裝執行的Visual Studio Code增加PYQT Integration的擴充功能

  1. 在Visual Studio Code安裝PYQT Integration的擴充功能
  2. 安裝PYQT Integration擴充功能後,將會增加下列功能,或更多,例如:
    從VS code直接開啟 designer.exe 新增 ui form,在VS Code下預覽 ui form ...

    PYQT: New FormOpen designer
    PYQT: Edit In DesignerOpen designer with current ui form
    PYQT: PreviewPreview current ui form
    PYQT: Compile FormCompile ui form to path defined in "pyqt-integration.pyuic.compile.filepath"
    PYQT: Compile ResourceCompile qrc file to path defined in "pyqt-integration.pyrcc.compile.filepath"
    PYQT: Generate Translation File (.ts)Compile UI file (.py) to translation file with path defined in "pyqt-integration.pylupdate.compile.filepath"
    Compile .pro file
    PYQT: Open With Qt LinguistOpen with Qt Linguist for translation file (.ts)
  3. 如果從 VS Code,無法正常啟動 designer.exe 或 pyuic5 ...,可以透過擴充延伸模組設定,指定正確的路徑、檔名 ...
  4. 以Qtdesigner這個設定項目為例,designer.exe,通常都是放在,Anaconda3安裝目錄的\Lib\site-packages\pyqt5_tools\路徑下。
  5. 設定項目的參考資料:
    pyqt-integration.qtdesigner.pathPath of executable file of qt designer, the extension will ask you to set at the first time it runs, e.g. c:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python35\\Lib\\site-packages\\pyqt5-tools\\designer.exe
    pyqt-integration.pyuic.cmd"pyuic" command, default "pyuic5"
    pyqt-integration.pyuic.compile.filepathCompile file path, relative path as default, switch to absolute path by involving ${workspace}, e.g. ${workspace}\\UI\\Ui_${ui_name}.py
    pyqt-integration.pyuic.compile.addOptionsAdditional options for pyuic compiling, it can be a combination of '-x', '-d', '-i', etc.
    pyqt-integration.pyrcc.cmd"pyrcc" command, default "pyrcc5"
    pyqt-integration.pyrcc.compile.filepathCompile file path, relative path as default, switch to absolute path by involving ${workspace}, e.g. ${workspace}\\QRC\\${qrc_name}_rc.py
    pyqt-integration.pyrcc.compile.addOptionsAdditional options for pyrcc compiling, it can be a combination of '-root', '-threshold', '-compress', '-no-compress', etc.
    pyqt-integration.pylupdate.cmd"pylupdate" command, default "pylupdate5"
    pyqt-integration.pylupdate.compile.filepathOnly works when compiling an UI file (.py), Stores the target '.ts' file's path, relative path as default, switch to absolute path by involving ${workspace}, e.g. ${workspace}\\TS\\${ts_name}.ts
    pyqt-integration.pylupdate.compile.addOptionsAdditional options for pylupdate, it can be a combination of '-verbose', '-noobsolete', '-tr-function', '-translate-function', etc.
    pyqt-integration.linguist.cmd"linguist" command, default "linguist"

讓在Anaconda Navigator環境下安裝的 Visual Studio Code (VS code),以繁體中文的介面顯示

安裝Visual Studio Code (VS Code) 繁體中文語言包(Chinese (Traditional) Language Pack for Visual Studio Code)的步驟:
  1. 點擊「Extensions」→在Extensions marketplace的搜尋方塊內輸入:chinese language pack,選取「Chinese (Traditional) Language Pack for Visual Studio Code」,可以查看VS Code 的中文(繁體)語言套件的說明擊使用方式。
  2. 點擊「Install」,安裝後會提示:重新開啟VS Code
  3. 重新啟動後,就會以繁體中文的語言界面顯示。如果沒有以中文顯示,可以參考以下的使用方式說明:
    安裝了之後,在 locale.json 裡面設定 "locale": "zh-tw" 即可載入中文(繁體)的語言套件。要修改locale.json,可以按下Ctrl+Shift+P來呼叫 命令選擇區,輸入 "config" 以從其他可用命令裡面篩選出 Configure Language 命令。

2019-08-02

在Anaconda3環境下安裝eric6 (The Eric Python IDE, v19.7),spyder也可以繼續正常使用

安裝Eric6 v19.7 前的環境:
  • Anaconda3 -2019.07 ( https://www.anaconda.com/distribution/#windows )
  • 已在Anaconda3環境下使用的Applications:Spyder(v3.3.6),  Jupyter Notebook(v6.0.0), Visual Studio Code(v1.36.1)。已安裝QtPy模組(v1.8.0)(QtPy provides support for PyQt5, PyQt4, PySide2 and PySide using the Qt5 layout (where the QtGui module has been split into QtGui and QtWidgets). https://pypi.org/project/QtPy/ )
  • Thonny (v3.1.2)。已安裝 pyqt5-tools模組(這個模組對pyqt5的版本需求是5.11.3)
在Anaconda3環境下安裝Eric6會失敗,主要是pyqt5已安裝版本,在有需求的Applications間的差異問題,修正pyqt5的安裝版本,即可順利安裝eric6。( https://eric-ide.python-projects.org/eric-download.html )

安裝過程,說明如下:
  1. 就按照Eric6網站上的安裝說明,取得最新版本
    https://sourceforge.net/projects/eric-ide/files/eric6/stable/19.07/eric6-19.7.zip/download 
  2. 將zip解壓縮至:Anaconda3安裝路徑下的以下位置:
    C:\ProgramData\Anaconda3\Lib\site-packages
  3. 以系統管理員身分,開啟Anaconda Prompt,切換至eric6解壓縮後的目錄下
    C:\ProgramData\Anaconda3\Lib\site-packages\eric6-19.7
  4. 安裝 eric6
    (base) C:\ProgramData\Anaconda3\Lib\site-packages\eric6-19.7>python install.py install
    Checking dependencies
    Python Version: 3.7.3
    Found PyQt5
    Found pyuic5
    QScintilla could not be detected.
    Error: cannot import name 'Qsci' from 'PyQt5' (C:\ProgramData\Anaconda3\lib\site-packages\PyQt5\__init__.py)

    Shall 'QScintilla' be installed using pip? (Y/n) Y
    Collecting QScintilla
      Downloading https://files.pythonhosted.org/packages/52/1a/ce7875f433fd0aa1d3774609586f77d78ff0524790942cca95e1d13a7ac7/QScintilla-2.11.2-5.12.4-cp35.cp36.cp37.cp38-none-win_amd64.whl (2.0MB)
    ...
    Collecting PyQt5>=5.10.1 (from QScintilla)
      Downloading https://files.pythonhosted.org/packages/3b/d3/76670a331935f58f9a2ebd53c6e9b670bbf15c458fa6993500af5d323160/PyQt5-5.13.0-5.13.0-cp35.cp36.cp37.cp38-none-win_amd64.whl (49.7MB)
    ...
    Collecting PyQt5_sip<13,>=4.19.14 (from PyQt5>=5.10.1->QScintilla)
      Downloading https://files.pythonhosted.org/packages/cf/c8/1e9eda4ba09a84fc528d4c87001de2d7a8cbbe04c2a834af3eb81a0ecd88/PyQt5_sip-4.19.18-cp37-none-win_amd64.whl (51kB)
    ...
    ERROR: spyder 3.3.6 requires pyqtwebengine<5.13; python_version >= "3", which is not installed.
    ERROR: spyder 3.3.6 has requirement pyqt5<5.13; python_version >= "3", but you'll have pyqt5 5.13.0 which is incompatible.

    Installing collected packages: PyQt5-sip, PyQt5, QScintilla

    ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 存取被拒。: 'C:\\ProgramData\\Anaconda3\\Lib\\site-packages\\PyQt5\\QtCore.pyd'
    Consider using the `--user` option or check the permissions.


    Sorry, please install QScintilla2 and
    its PyQt5/PyQt4 wrapper.
    Error: QScintilla could not be installed.

    Press enter to continue...
  5. eric6安裝發生錯誤的原因:
    安裝eric6需要安裝QScintilla,需要PyQt5 5.10.1 以上的版本,系統自動收集安裝了 pyqt5 5.13.0的版本。
    但已安裝的spyder 3.3.6 限制 pyqt5 必須是 v5.13以下 (<5.13)
  6. 重新安裝pyqt5-tools,並指定安裝版本為 5.11.3
    (base) C:\ProgramData\Anaconda3>pip install pyqt5==5.11.3
    Collecting pyqt5==5.11.3
      Downloading https://files.pythonhosted.org/packages/a7/2d/d2c989006c86ae98ed230c28c3e0dd7fa0374e723afc107d12268159ceb7/PyQt5-5.11.3-5.11.2-cp35.cp36.cp37.cp38-none-win_amd64.whl (93.4MB)
    ...
    ERROR: spyder 3.3.6 requires pyqtwebengine<5.13; python_version >= "3", which is not installed.
    Installing collected packages: pyqt5
    Successfully installed pyqt5-5.11.3
  7. 安裝pyqt5-tools
    (base) C:\ProgramData\Anaconda3>pip install pyqt5-tools
    Collecting pyqt5-tools
      Downloading https://files.pythonhosted.org/packages/6a/35/98279ba706e9c3731f0f53813e9a8152ed662f2230e8af18a20d490167be/pyqt5_tools-5.11.3.1.4-cp37-none-win_amd64.whl (59.4MB)
    ...
    Requirement already satisfied: pyqt5==5.11.3 in c:\programdata\anaconda3\lib\site-packages (from pyqt5-tools) (5.11.3)
    Requirement already satisfied: click in c:\programdata\anaconda3\lib\site-packages (from pyqt5-tools) (7.0)
    Collecting python-dotenv (from pyqt5-tools)
      Downloading https://files.pythonhosted.org/packages/57/c8/5b14d5cffe7bb06bedf9d66c4562bf90330d3d35e7f0266928c370d9dd6d/python_dotenv-0.10.3-py2.py3-none-any.whl
    Requirement already satisfied: PyQt5_sip<4.20,>=4.19.11 in c:\programdata\anaconda3\lib\site-packages (from pyqt5==5.11.3->pyqt5-tools) (4.19.18)
    Installing collected packages: python-dotenv, pyqt5-tools
    Successfully installed pyqt5-tools-5.11.3.1.4 python-dotenv-0.10.3

  8. 安裝 eric6
    (base) C:\ProgramData\Anaconda3\Lib\site-packages\eric6-19.7>python install.py install
    Checking dependencies
    Python Version: 3.7.3
    Found PyQt5
    Found pyuic5
    QScintilla could not be detected.
    Error: cannot import name 'Qsci' from 'PyQt5' (C:\ProgramData\Anaconda3\lib\site-packages\PyQt5\__init__.py)

    Shall 'QScintilla' be installed using pip? (Y/n) Y
    Collecting QScintilla
      Using cached https://files.pythonhosted.org/packages/52/1a/ce7875f433fd0aa1d3774609586f77d78ff0524790942cca95e1d13a7ac7/QScintilla-2.11.2-5.12.4-cp35.cp36.cp37.cp38-none-win_amd64.whl
    Requirement already satisfied: PyQt5>=5.10.1 in c:\programdata\anaconda3\lib\site-packages (from QScintilla) (5.11.3)
    Requirement already satisfied: PyQt5_sip<4.20,>=4.19.11 in c:\programdata\anaconda3\lib\site-packages (from PyQt5>=5.10.1->QScintilla) (4.19.18)
    Installing collected packages: QScintilla
    Successfully installed QScintilla-2.11.2
    Found QScintilla2
    Found QtGui
    Found QtNetwork
    Found QtPrintSupport
    Found QtSql
    Found QtSvg
    Found QtWidgets
    Found QtWebEngineWidgets
    Qt Version: 5.11.2
    sip Version: 4.19.18
    PyQt Version: 5.11.3
    QScintilla Version: 2.11.2
    All dependencies ok.
    Cleaning up old installation ...
    Creating configuration file ...
    Compiling user interface files ...
    Compiling source files ...
    Installing eric6 ...
    Installing Python API files to 'C:/ProgramData/Anaconda3/lib/site-packages/PyQt5/Qt\qsci\api\python'.
    Installing Ruby API files to 'C:/ProgramData/Anaconda3/lib/site-packages/PyQt5/Qt\qsci\api\ruby'.
    Installing QSS API files to 'C:/ProgramData/Anaconda3/lib/site-packages/PyQt5/Qt\qsci\api\qss'.
    Installation complete.
    Press enter to continue...
  9. 安裝 eric6 成功
    • 確認可以啟動 spyder
    • 確認可以啟動designer.exe
    • 確認可以啟動 eric6

2019-07-31

使用Anaconda Navigator安裝 Python的開發工具VS code

讓Anaconda Navigator來協助開發環境(environment)、模組(package)的管理,是一件愉快的事!
之前已經使用過Jupyter Noteboks、Thonny、Spyder ...等,總有一些功能不能盡如人意,試試VS code,感覺令人滿意。
  • AutoCompletion (IntelliSense ) / 自動補全 / 自動完成  / 輸入提示 ...,例如:
    import sys
    from PyQt5 import QtWidgets
    oApp=QtWidgets.QApplication(sys.argv)
    oWidget=QtWidgets.QWidget()
    ##以上Jupyter Noteboks、Thonny、Spyder 都還可以順利使用 AutoCompletion
    oWidget.resize(300,100)
    ##上面這一行,輸入oWidget. 後,
    ##Jupyter Noteboks、Thonny、Spyder...
    ##通通無法帶出提示,知道有多少方法、屬性的選項,
    ##真的記不了那麼多啦...
    ##但是 VS code 可以辦到...
  • Code Folding / 程式碼折疊
    習慣了使用NotePad++的程式碼摺疊功能後,沒有這個功能可以用,會忽然手足無措,尤其是在面對Python用「縮排」的作法取代其他程式語言用 { } 來表示函式、控制敘述...的執行範圍,沒有明顯的 end of def / if / for/ while ... 的標示,程式的辨識很容易混淆,又開始懷念 notepad++ 了 ...
    Notepad++ 的 Code Folding / 程式碼折疊

    Notepad++ 的 Code Folding / 程式碼折疊
VS code滿足了當前我最需要的功能:AutoCompletion(IntelliSense)、Code Folding不用就太可惜了,用Anaconda Navigator安裝VS Code超簡單的 ...

  • Anaconda Navigator → Home,可以查看那些基於Anaconda的應用程式已經安裝?有哪些準備Ready的程式可以安裝?
  • 安裝完成後,「Install」鈕,變成「Launch」鈕,按下Launch就可以開始用了...

2019-07-23

Anaconda Python模組管理(Package) : 使用 Anaconda Navigator 更新、安裝模組

  1. 開啟Anaconda Navigator
  2. 選擇『Environment』
    點擊『』,先把環境選取的區塊收起來
    在Anaconda Package區塊中,
    模組Package選項:installed / Not installed / Updatable / Selected / All,選擇:All
    在package搜尋文字方塊中,輸入搜尋標的,例如:pyinstaller
  3. 『Apply』安裝

2019-07-22

Toshiba Satellite C640 重新安裝 Win 10 的工作清單


  1. Toshiba Satellite C640的硬體環境:
    • 2011年份
    • Intel Pentium B940@2.00GHz * 2,64位元,記憶體4GB。
    • 原硬碟已更換為256GB SSD,R/W DVD/CD 光碟機繼續使用。
    • 觸控板,外加藍芽滑鼠。
    • 網卡:Qualcomm Atheros AR8152,無線:Qualcomm Atheros AR9002WB-1NG
  2. 作業系統歷程:
    • 隨機:win 7 home prem
    • 升級安裝 win 10 home
    • 本次重新安裝 win 10 home 版次 1903 (ISO檔中有三個選項:家用 / 教育 / 專業,就按照原先取得的授權選擇家用版)
  3. 重安裝歷程:
    • 原win 10 按住 shift 再執行關機。 (清除快速開機的快取)
    • win 10 ISO image 燒錄至USB,一直無法成功開機進入安裝程式。
    • 將win 10 ISO image 燒錄至DVD,成功完成安裝。
      清除所所SSD上原先從舊硬碟GHOST過來的分割,清除四個分割整理成一個未分割的SSD,讓win 10安裝程式自行分割安裝。
  4. 相關硬體驅動及設定的確認:
    • 裝置管理員確認所有硬體均可正常驅動。
    • 手動新增藍芽滑鼠DWIRAY 型號:MB288 ,成功。
    • 電源選項,設定:選擇『選擇蓋上螢幕時的行為』,『當我關閉筆記電腦螢幕時』,『電池使用中』或『一般電源』都選取『不進行動作』。
      (開機後關上螢幕,丟到一旁遠端遙控使用。
    • 選擇關閉顯示器的時機:電池→1分鐘,一般電源→3分鐘
    • 變更電腦休眠的時間:電池→30分鐘,一般電源→永不
  5. 桌面基本需求建立:
    • 命令提示字元(System32\cmd.exe):加到工作列
    • 剪取工具(System32\SnippingTool.exe):加到工具列
    • 小畫家(System32\mspaint.exe):加到工具列
    • 筆記本(System32\notepad.exe):加到工具列
  6. 安裝Anaconda3:
    • https://www.anaconda.com/  
    • 安裝的版本:Anaconda2-2019.03-Windows-x86_86.exe
    • 安裝選項:
      Install for : All Users
      Destination Folder : C:\ProgramData\Anaconda3
      (勾選)Add Anaconda to the system PATH environment variable
      Not recommended . Instead, open Anaconda with the Windows Start menu and select "Anaconda(64-bit)". This "add to PATH option makes Anaconda get found before previously installed software, but may cause problems requiring you to uninstall and reinstall Anaconda.
      (勾選)Register Anaconda as the system Python 3.7
      This will allow other programs, such as python Tools for Visual Studio, PyCharm, Wing IDE, PyDev, and MSI binary packages, to automatically detect Anaconda as the primary Python 3.7 on the system.
    • 安裝前後環境變數的變化:
      控制台→系統及安全性→系統:進階系統設定:『進階』分頁:環境變數:
      安裝前:
      • 使用者變數:
        Ondrive : C:\Users\Hannibal\OneDrive
        Path: %USERPROFILE%\AppData\Local\MicroSoft\WindowsApps
        TEMP:%USERPROFILE%\AppData\Local\Temp
        TMP:%USERPROFILE%\AppData\Local\Temp
      • 系統變數:
        ComSpec: %SystemRoot%\system32\cmd.exe
        DriverData : C:\Windows\System32\Drivers\DriverData
        NUMBER_OF_PROCESSORS : 2
        OS : Windows_NT
        Path : %SystemRoot%\System32; %SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\
        PATHEXT : .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.WSH;.MSC
        PROCESSOR_ARCHITECTURE : AMD64
        PROCESSOR_IDENTIFIER : Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
        PROCESSOR_LEVEL : 6
        PROCESSOR_REVISION : 2a07
        PSModulePath: %ProgramFiles%\WindowsPowerShell\Modules;%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules
        TEMP : C:\Windows\TEMP
        TMP : C:\Windows\TEMP
        USERNAME : SYSTEM
        windir : C:\Windows
      • 安裝後環境變數的變化:
        使用者變數:沒改變
        系統變數:Path中增加了→
        c:\ProgramData\Anaconda3
        c:\ProgramData\Anaconda3\Library\mingw-w64\bin
        c:\ProgramData\Anaconda3\Library\usr\bin
        c:\ProgramData\Anaconda3\Library\bin
      • c:\ProgramData\Anaconda3\Scripts
      • Anaconda and JetBrains are working together to bring you Anaconda-powered environments tightly integrated in the PyCharm IDE.
        PyCharm for Anacondas is avaiable at : https://www.anaconda.com/pycharm 
      • Learn more about Anaconda Cloud : https://anaconda.org 
      • Learn how to get started with Anaconda :   http://docs.anaconda.com/anaconda/user-guide/getting-started 
      • 將Anaconda Navigator, Jupyter Notebook, Spyder 三個程式捷徑放到桌面,方便使用。
  7. 其他需要安裝的軟體:
    • 7-zip : 取自 sourceforge.net
    • Google Chrome 瀏覽器
    • 安裝VNC server,使用tightVNC 
      • https://www.tightvnc.com/downloads 
      • 安裝選項:
        Setup Type : Complete
        (勾選)Associate .vnc files with TightVNC Viewer
        (勾選)Register TightVNC Server as a system service
        (勾選)Configure system to allow services simulate Ctrl+Alt+Del
        Password for Remote Access
        Administrative Password
      • 確認TightVNC服務已啟動