<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ### 導航 - [索引](../genindex.xhtml "總目錄") - [模塊](../py-modindex.xhtml "Python 模塊索引") | - [下一頁](../howto/index.xhtml "Python 常用指引") | - [上一頁](../distributing/index.xhtml "分發 Python 模塊") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) ? - zh\_CN 3.7.3 [文檔](../index.xhtml) ? - $('.inline-search').show(0); | # 安裝 Python 模塊 電子郵箱[distutils-sig@python.org](mailto:distutils-sig%40python.org) 作為一個流行的開源開發項目,Python擁有一個活躍的貢獻者和用戶支持社區,這些社區也可以讓他們的軟件可供其他Python開發人員在開源許可條款下使用。 這允許Python用戶有效地共享和協作,從其他人已經創建的解決方案中受益于常見(有時甚至是罕見的)問題,以及可以提供他們自己的解決方案。 本指南涵蓋了分發部分的流程。有關安裝其他Python項目的指南,請參閱 [安裝指南](../distributing/index.xhtml#distributing-index)。 注解 對于企業和其他機構用戶,請注意許多組織都有自己的政策來使用和貢獻開源軟件。在使用Python提供的分發和安裝工具時,請考慮這些政策。 ## 關鍵術語 - `pip` 是首選的安裝程序。從Python 3.4開始,它默認包含在Python二進制安裝程序中。 - *virtual environment* 是一種半隔離的 Python 環境,允許為特定的應用安裝各自的包,而不是安裝到整個系統。 - `venv` 是創建虛擬環境的標準工具,從 Python 3.3 開始成為 Python 的組成部分。 從 Python 3.4 開始,它會默認安裝 `pip` 到所創建的全部虛擬環境。 - `virtualenv` 是 `venv` 的第三方替代(及其前身)。 它允許在 Python 3.4 之前的版本中使用虛擬環境,那些版本或是完全不提供 `venv`,或是不會自動安裝 `pip` 到所創建的虛擬環境。 - [Python Packaging Index](https://pypi.org) \[https://pypi.org\] 是一個由 Python 用戶向其他用戶發布開源許可軟件包的公共倉庫。 - [Python Packaging Authority](https://www.pypa.io/) \[https://www.pypa.io/\] 是負責標準打包工具以及相關元數據和文件格式標準維護與改進的開發人員和文檔作者團隊。 他們基于 [GitHub](https://github.com/pypa) \[https://github.com/pypa\] 和 [BitBucket](https://bitbucket.org/pypa/) \[https://bitbucket.org/pypa/\] 這兩個平臺維護著各種工具、文檔和問題追蹤系統。 - `distutils` 是最初的構建和分發系統,于 1998 年首次加入 Python 標準庫。 雖然直接使用 `distutils` 的方式已被淘汰,它仍然是當前打包和分發架構的基礎,而且它不僅仍然是標準庫的一部分,這個名稱還以其他方式存在(例如用于協調 Python 打包標準開發流程的郵件列表就以此命名)。 3\.6 版后已移除: `pyvenv` 是 Python 3.3 和 3.4 中創建虛擬環境的推薦工具,不過 [在 Python 3.6 中已棄用](https://docs.python.org/dev/whatsnew/3.6.html#deprecated-features) \[https://docs.python.org/dev/whatsnew/3.6.html#deprecated-features\]。 在 3.5 版更改: 現在推薦使用 `venv` 來創建虛擬環境。 參見 [Python 軟件包用戶指南:創建和使用虛擬環境](https://packaging.python.org/installing/#creating-virtual-environments) \[https://packaging.python.org/installing/#creating-virtual-environments\] ## 基本使用 標準打包工具完全是針對命令行使用方式來設計的。 以下命令將從 Python Packaging Index 安裝一個模塊的最新版本及其依賴項: ``` python -m pip install SomePackage ``` 注解 對于 POSIX 用戶(包括 Mac OS X 和 Linux 用戶)本指南中的示例假定使用了 [virtual environment](../glossary.xhtml#term-virtual-environment)。 對于 Windows 用戶,本指南中的示例假定在安裝 Python 時選擇了修改系統 PATH 環境變量。 在命令行中指定一個準確或最小版本也是可以的。 當使用比較運算符例如 `>`, `<` 或其他某些可以被終端所解析的特殊字符時,包名稱與版本號應當用雙引號括起來: ``` python -m pip install SomePackage==1.0.4 # specific version python -m pip install "SomePackage>=1.0.4" # minimum version ``` 通常,如果一個匹配的模塊已安裝,嘗試再次安裝將不會有任何效果。 要升級現有模塊必須顯式地發出請求: ``` python -m pip install --upgrade SomePackage ``` 更多有關 `pip` 及其功能的信息和資源可以在 [Python 軟件包用戶指南](https://packaging.python.org) \[https://packaging.python.org\] 中找到。 虛擬環境的創建可使用 [`venv`](../library/venv.xhtml#module-venv "venv: Creation of virtual environments.") 模塊來完成。 向已激活虛擬環境安裝軟件包可使用上文所介紹的命令。 參見 [Python 軟件包用戶指南:安裝 Python 分發包](https://packaging.python.org/installing/) \[https://packaging.python.org/installing/\] ## 我應如何 ...? 這是一些常見任務的快速解答或相關鏈接。 ### ... 在 Python 3.4 之前的 Python 版本中安裝 `pip` ? Python 捆綁 `pip` 是從 Python 3.4 才開始的。 對于更早的版本,`pip` 需要“引導安裝bootstrapped”,具體說明參見 Python 軟件包用戶指南。 參見 [Python 軟件包用戶指南:安裝軟件包的前提要求](https://packaging.python.org/installing/#requirements-for-installing-packages) \[https://packaging.python.org/installing/#requirements-for-installing-packages\] ### ... 只為當前用戶安裝軟件包? 將 `--user` 選項傳入 `python -m pip install` 將只為當前用戶而非為系統中的所有用戶安裝軟件包。 ### ... 安裝科學計算類 Python 軟件包? 許多科學計算類 Python 軟件包都有復雜的二進制編譯文件依賴,直接使用 `pip` 安裝目前并不太容易。 在當前情況下,通過 [其他方式](https://packaging.python.org/science/) \[https://packaging.python.org/science/\] 而非嘗試用 `pip` 安裝這些軟件包對用戶來說通常會更容易。 參見 [Python 軟件包用戶指南:安裝科學計算類軟件包](https://packaging.python.org/science/) \[https://packaging.python.org/science/\] ### ... 使用并行安裝的多個 Python 版本? 在 Linux, Mac OS X 以及其他 POSIX 系統中,使用帶版本號的 Python 命令配合 `-m` 開關選項來運行特定版本的 `pip`: ``` python2 -m pip install SomePackage # default Python 2 python2.7 -m pip install SomePackage # specifically Python 2.7 python3 -m pip install SomePackage # default Python 3 python3.4 -m pip install SomePackage # specifically Python 3.4 ``` 也可以使用帶特定版本號的 `pip` 命令。 在 Windows 中,使用 `py` Python 啟動器命令配合 `-m` 開關選項: ``` py -2 -m pip install SomePackage # default Python 2 py -2.7 -m pip install SomePackage # specifically Python 2.7 py -3 -m pip install SomePackage # default Python 3 py -3.4 -m pip install SomePackage # specifically Python 3.4 ``` ## 常見的安裝問題 ### 在 Linux 的系統 Python 版本上安裝 Linux 系統通常會將某個 Python 版本作為發行版的一部分包含在內。 將軟件包安裝到這個 Python 版本上需要系統 root 權限,并可能會干擾到系統包管理器和其他系統組件的運作,如果這些組件在使用 `pip` 時被意外升級的話。 在這樣的系統上,通過 `pip` 安裝軟件包通常最好是使用虛擬環境或分用戶安裝。 ### 未安裝 pip 默認情況下可能未安裝 `pip`,一種可選解決方案是: ``` python -m ensurepip --default-pip ``` 還有其他資源可用來 [安裝 pip](https://packaging.python.org/tutorials/installing-packages/#install-pip-setuptools-and-wheel) \[https://packaging.python.org/tutorials/installing-packages/#install-pip-setuptools-and-wheel\] ### 安裝二進制編譯擴展 Python 通常非常依賴基于源代碼的發布方式,也就是期望最終用戶在安裝過程中使用源碼來編譯生成擴展模塊。 隨著對二進制碼 `wheel` 格式支持的引入,以及通過 Python Packaging Index 至少發布 Windows 和 Mac OS X 版的 wheel 文件,預計此問題將逐步得到解決,因為用戶將能夠更頻繁地安裝預編譯擴展,而不再需要自己編譯它們。 某些用來安裝 [科學計算類軟件包](https://packaging.python.org/science/) \[https://packaging.python.org/science/\] 的解決方案對于尚未提供預編譯 `wheel` 文件的那些擴展模塊來說,也有助于用戶在無需進行本機編譯的情況下獲取二進制碼擴展模塊。 參見 [Python 軟件包用戶指南:二進制碼擴展](https://packaging.python.org/extensions/) \[https://packaging.python.org/extensions/\] ### 導航 - [索引](../genindex.xhtml "總目錄") - [模塊](../py-modindex.xhtml "Python 模塊索引") | - [下一頁](../howto/index.xhtml "Python 常用指引") | - [上一頁](../distributing/index.xhtml "分發 Python 模塊") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) ? - zh\_CN 3.7.3 [文檔](../index.xhtml) ? - $('.inline-search').show(0); | ? [版權所有](../copyright.xhtml) 2001-2019, Python Software Foundation. Python 軟件基金會是一個非盈利組織。 [請捐助。](https://www.python.org/psf/donations/) 最后更新于 5月 21, 2019. [發現了問題](../bugs.xhtml)? 使用[Sphinx](http://sphinx.pocoo.org/)1.8.4 創建。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看