Skip to content

Instantly share code, notes, and snippets.

@uranusjr
Last active October 16, 2017 08:00
Show Gist options
  • Select an option

  • Save uranusjr/91969cb2826d11d8e9e8f636b9ac1b97 to your computer and use it in GitHub Desktop.

Select an option

Save uranusjr/91969cb2826d11d8e9e8f636b9ac1b97 to your computer and use it in GitHub Desktop.

Revisions

  1. uranusjr revised this gist Oct 11, 2017. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions snafu-tutorial-chinese.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    **注意:指令在後續版本略有修改,建議閱讀專案 README。**

    # SNAFU 使用教學(暫定)

    這篇文章會簡單描述如何使用 [SNAFU Python installer manager](https://github.com/uranusjr/snafu)
  2. uranusjr renamed this gist Oct 9, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. uranusjr revised this gist Oct 9, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snafu-tutorial.md
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@ snafu activate 3.6

    這會讓 `python3` 指令指向 Python 3.6,並讓 Python 3.6 相關的指令(例如 `pip3``pip3.6` 等等)可被執行。

    > **註:**\ 為了避免混淆,SNAFU 不提供沒有版本號的 `python``pip` 指令。請使用帶版本號的 `python3`/`python2``pip3`/`pip2`
    > 註:為了避免混淆,SNAFU 不提供沒有版本號的 `python``pip` 指令。請使用帶版本號的 `python3`/`python2``pip3`/`pip2`
    安裝套件:

  4. uranusjr revised this gist Oct 9, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snafu-tutorial.md
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@ snafu activate 3.6

    這會讓 `python3` 指令指向 Python 3.6,並讓 Python 3.6 相關的指令(例如 `pip3``pip3.6` 等等)可被執行。

    > **註:**為了避免混淆,SNAFU 不提供沒有版本號的 `python``pip` 指令。請使用帶版本號的 `python3`/`python2``pip3`/`pip2`
    > **註:**\ 為了避免混淆,SNAFU 不提供沒有版本號的 `python``pip` 指令。請使用帶版本號的 `python3`/`python2``pip3`/`pip2`
    安裝套件:

  5. uranusjr revised this gist Oct 9, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions snafu-tutorial.md
    Original file line number Diff line number Diff line change
    @@ -46,10 +46,10 @@ snafu activate 3.6
    pip3.6 install ipython
    ```

    把安裝的指令(例如 `ipython.exe` 同步到 `PATH`
    把安裝的指令同步到 `PATH` 中:

    ```
    snafu activate
    snafu link ipython
    ```

    就可以執行
  6. uranusjr revised this gist Oct 9, 2017. 1 changed file with 13 additions and 4 deletions.
    17 changes: 13 additions & 4 deletions snafu-tutorial.md
    Original file line number Diff line number Diff line change
    @@ -74,19 +74,28 @@ ipython

    ### 安裝後無法執行 `snafu` 指令

    試著執行
    先嘗試**重新開機****重新安裝 SNAFU**

    如果上面的方法無法解決,可以試著執行下面的指令:

    ```
    %LOCALAPPDATA%\Programs\SNAFU\cmd\snafu
    ```

    如果可以正常啟動,請試著**重新開機**
    如果可以成功執行(會顯示指令說明),則可以手動在 `PATH` 環境變數中添加下面兩個路徑:

    * `%LOCALAPPDATA%\Programs\SNAFU\cmd`
    * `%LOCALAPPDATA%\Programs\SNAFU\scripts`

    重開 command prompt 後就可以正常使用。

    ### 執行時跳出缺少 DLL 錯誤

    如果出現下面的錯誤:

    ![Windows CRT Runtime error](http://d.pr/i/L28ljA+)
    ![Windows CRT Runtime error](https://d.pr/i/L28ljA+)

    代表你的系統太舊。請照下列步驟解決:
    代表你的系統太舊,且 SNAFU 無法自動為你下載 Windows 更新。請照下列步驟解決:

    1. 根據你的系統下載 [Universal C Runtime 更新](https://support.microsoft.com/zh-tw/help/2999226/update-for-universal-c-runtime-in-windows)
    2. 安裝 Universal C Runtime。
  7. uranusjr revised this gist Oct 9, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snafu-tutorial.md
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@ snafu activate 3.6

    這會讓 `python3` 指令指向 Python 3.6,並讓 Python 3.6 相關的指令(例如 `pip3``pip3.6` 等等)可被執行。

    > **註:**如果為了避免混淆,SNAFU 不提供沒有版本號的 `python``pip` 指令。請使用帶版本號的 `python3`/`python2``pip3`/`pip2`
    > **註:**為了避免混淆,SNAFU 不提供沒有版本號的 `python``pip` 指令。請使用帶版本號的 `python3`/`python2``pip3`/`pip2`
    安裝套件:

  8. uranusjr revised this gist Oct 9, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion snafu-tutorial.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    這篇文章會簡單描述如何使用 [SNAFU Python installer manager](https://github.com/uranusjr/snafu)

    這個專案源自我對社群不懂 Windows 又愛亂教的不滿。如果有興趣讀相關故事,以及一些背後邏輯,可以參考我在碼天狗上的抱怨文
    這個專案源自我對社群不懂 Windows 又愛亂教的不滿。如果有興趣讀相關故事,以及一些背後邏輯,可以參考我[在碼天狗上的抱怨文](https://weekly.codetengu.com/issues/101#w1ctkwH)


    ## 特點
  9. uranusjr created this gist Oct 8, 2017.
    97 changes: 97 additions & 0 deletions snafu-tutorial.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,97 @@
    # SNAFU 使用教學(暫定)

    這篇文章會簡單描述如何使用 [SNAFU Python installer manager](https://github.com/uranusjr/snafu)

    這個專案源自我對社群不懂 Windows 又愛亂教的不滿。如果有興趣讀相關故事,以及一些背後邏輯,可以參考我在碼天狗上的抱怨文。


    ## 特點

    * 使用 CPython 官方釋出的安裝檔,不另行編譯
    * 直接整合官方安裝,即使不是用 SNAFU 安裝的 Python 版本,也可以輕鬆移到 SNAFU 管理
    * 僅限 CPython 官方安裝,不包含 PyPy、Anaconda 等第三方發行版
    * 統一處理 `PATH` 環境變數,免除手動管理


    ## 安裝

    根據作業系統[下載安裝檔](https://github.com/uranusjr/snafu/releases)並執行。

    安裝完成後,應該會得到一個 `snafu` 指令(錯誤排除參考下面 FAQ)。


    ## 基本使用

    安裝 Python 3.6:

    ```
    snafu install 3.6
    ```

    這會得到一個 `python3.6` 指令。

    讓 Python 3.6 成為預設:

    ```
    snafu activate 3.6
    ```

    這會讓 `python3` 指令指向 Python 3.6,並讓 Python 3.6 相關的指令(例如 `pip3``pip3.6` 等等)可被執行。

    > **註:**如果為了避免混淆,SNAFU 不提供沒有版本號的 `python``pip` 指令。請使用帶版本號的 `python3`/`python2``pip3`/`pip2`
    安裝套件:

    ```
    pip3.6 install ipython
    ```

    把安裝的指令(例如 `ipython.exe` 同步到 `PATH` 中):

    ```
    snafu activate
    ```

    就可以執行

    ```
    ipython
    ```


    ## 其他指令

    可以從 `snafu --help` 獲得可用的指令列表,並用 `snafu <command> --help` 獲得指令說明。

    * `uninstall`:反安裝 Python 版本。
    * `list`:列出已安裝的 Python 版本。
    * `list --all`:列出所有可安裝的 Python 版本。
    * `activate`:啟用某 Python 版本的相關指令。
    * `where`:顯示某 Python 版本的 `python.exe` 位置。


    ## FAQ

    ### 安裝後無法執行 `snafu` 指令

    試著執行

    ```
    %LOCALAPPDATA%\Programs\SNAFU\cmd\snafu
    ```

    如果可以正常啟動,請試著**重新開機**

    如果出現下面的錯誤:

    ![Windows CRT Runtime error](http://d.pr/i/L28ljA+)

    代表你的系統太舊。請照下列步驟解決:

    1. 根據你的系統下載 [Universal C Runtime 更新](https://support.microsoft.com/zh-tw/help/2999226/update-for-universal-c-runtime-in-windows)
    2. 安裝 Universal C Runtime。
    3. **重新安裝 SNAFU**

    ### 我有其他問題

    可以到 <https://github.com/uranusjr/snafu/issues> 反應。