久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='FThuy'></tfoot>
    1. <legend id='FThuy'><style id='FThuy'><dir id='FThuy'><q id='FThuy'></q></dir></style></legend>

    2. <i id='FThuy'><tr id='FThuy'><dt id='FThuy'><q id='FThuy'><span id='FThuy'><b id='FThuy'><form id='FThuy'><ins id='FThuy'></ins><ul id='FThuy'></ul><sub id='FThuy'></sub></form><legend id='FThuy'></legend><bdo id='FThuy'><pre id='FThuy'><center id='FThuy'></center></pre></bdo></b><th id='FThuy'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FThuy'><tfoot id='FThuy'></tfoot><dl id='FThuy'><fieldset id='FThuy'></fieldset></dl></div>

      <small id='FThuy'></small><noframes id='FThuy'>

      • <bdo id='FThuy'></bdo><ul id='FThuy'></ul>

      1. 配置 Python 以使用站點包的其他位置

        Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
        <i id='BXwYb'><tr id='BXwYb'><dt id='BXwYb'><q id='BXwYb'><span id='BXwYb'><b id='BXwYb'><form id='BXwYb'><ins id='BXwYb'></ins><ul id='BXwYb'></ul><sub id='BXwYb'></sub></form><legend id='BXwYb'></legend><bdo id='BXwYb'><pre id='BXwYb'><center id='BXwYb'></center></pre></bdo></b><th id='BXwYb'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='BXwYb'><tfoot id='BXwYb'></tfoot><dl id='BXwYb'><fieldset id='BXwYb'></fieldset></dl></div>

            <bdo id='BXwYb'></bdo><ul id='BXwYb'></ul>
              <tbody id='BXwYb'></tbody>

                <legend id='BXwYb'><style id='BXwYb'><dir id='BXwYb'><q id='BXwYb'></q></dir></style></legend><tfoot id='BXwYb'></tfoot>

                <small id='BXwYb'></small><noframes id='BXwYb'>

                • 本文介紹了配置 Python 以使用站點包的其他位置的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  有沒有辦法在不修改現(xiàn)有腳本的情況下告訴 Python 其他 site-packages 位置?

                  在我的 CentOS 5.5 服務器上,我有一個安裝在 /opt/python2.7.2 中的 Python 2.7 安裝,并且 中有一個 site-packages 文件夾/opt/python2.7.2/lib/python2.7/site-packages.

                  這樣做的原因是我不想干擾 5.5 發(fā)行版附帶的現(xiàn)有 Python 2.4 安裝.

                  然而,第三方 Python 應用程序還在 /usr/local/lib/python2.7/site-packages 添加了一個 site-packages 文件夾,并將其自身安裝在那個位置.

                  這部分是我的錯,因為我沒有在安裝之前調(diào)整應用程序的 Makefile 中的 PREFIX,但是我現(xiàn)在無能為力.

                  我知道我可以做到:

                  導入系統(tǒng);sys.path.insert(0, "/usr/local/lib/python2.7/site-packages")

                  但是,這將涉及我跟蹤每個腳本并添加上述內(nèi)容,如果將來有更新,這并不理想.

                  為了解決這個問題,我在 /opt/python2.7.2/lib/python2.7/site-packages 中創(chuàng)建了一個指向此第三方應用程序位置的符號鏈接:

                  <上一頁>ln -sf/usr/local/lib/python2.7/site-packages/theapp/opt/python2.7.2/lib/python2.7/site-packages/theapp

                  這似乎工作正常,但我想知道是否有更好的方法?

                  解決方案

                  您可以使用 Site-具體配置鉤子.

                  <塊引用>

                  "路徑配置文件是一個文件名,格式為name.pth,存在于上述四個目錄之一中;其內(nèi)容是要添加的附加項(每行一個)到 sys.path."

                  在您的情況下,您應該能夠通過簡單地放入包含要包含的目錄路徑的 .pth 文件來實現(xiàn)您想要的:

                  [root@home]$ echo "/usr/local/lib/python2.7/site-packages/" >/opt/python2.7.2/lib/python2.7/site-packages/usrlocal.pth

                  Is there a way to tell Python about additional site-packages locations without modifying existing scripts?

                  On my CentOS 5.5 server I have a Python 2.7 installation that is installed in /opt/python2.7.2 and there is a site-packages folder at /opt/python2.7.2/lib/python2.7/site-packages.

                  The reason for this is that I didn't want to disturb the existing Python 2.4 install that shipped with the 5.5 distribution.

                  However a third party Python application also added a site-packages folder at: /usr/local/lib/python2.7/site-packages and installed itself at that location.

                  This is partly my fault because I didn't tweak the PREFIX in the application's Makefile before installing, however there's not much I can do about it now.

                  I know that I can do this:

                  import sys; sys.path.insert(0, "/usr/local/lib/python2.7/site-packages")
                  

                  However it would involve me tracking down every script and adding the above which is not ideal should there be updates in the future.

                  To get around this I created a symbolic link in /opt/python2.7.2/lib/python2.7/site-packages to the location of this third party application:

                  ln -sf /usr/local/lib/python2.7/site-packages/theapp /opt/python2.7.2/lib/python2.7/site-packages/theapp
                  

                  This appears to work fine but I'm wondering if there's a better way?

                  解決方案

                  You can use the Site-specific configuration hook.

                  "A path configuration file is a file whose name has the form name.pth and exists in one of the four directories mentioned above; its contents are additional items (one per line) to be added to sys.path."

                  In your case, you should be able to achieve what you want by simply dropping in a .pth file containing the path of the directory to include:

                  [root@home]$ echo "/usr/local/lib/python2.7/site-packages/" > /opt/python2.7.2/lib/python2.7/site-packages/usrlocal.pth
                  

                  這篇關于配置 Python 以使用站點包的其他位置的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                  How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構(gòu)造python包)
                  Install python packages on OpenShift(在 OpenShift 上安裝 python 包)
                  How to refresh sys.path?(如何刷新 sys.path?)
                  Distribute a Python package with a compiled dynamic shared library(分發(fā)帶有已編譯動態(tài)共享庫的 Python 包)
                  R, Python: install packages on rpy2(R,Python:在 rpy2 上安裝包)

                  • <tfoot id='4d2H4'></tfoot>
                  • <legend id='4d2H4'><style id='4d2H4'><dir id='4d2H4'><q id='4d2H4'></q></dir></style></legend>

                    <small id='4d2H4'></small><noframes id='4d2H4'>

                    <i id='4d2H4'><tr id='4d2H4'><dt id='4d2H4'><q id='4d2H4'><span id='4d2H4'><b id='4d2H4'><form id='4d2H4'><ins id='4d2H4'></ins><ul id='4d2H4'></ul><sub id='4d2H4'></sub></form><legend id='4d2H4'></legend><bdo id='4d2H4'><pre id='4d2H4'><center id='4d2H4'></center></pre></bdo></b><th id='4d2H4'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='4d2H4'><tfoot id='4d2H4'></tfoot><dl id='4d2H4'><fieldset id='4d2H4'></fieldset></dl></div>
                        <tbody id='4d2H4'></tbody>
                        <bdo id='4d2H4'></bdo><ul id='4d2H4'></ul>

                            主站蜘蛛池模板: 亚洲成av人片在线观看无码 | 91在线观 | 久综合| 日本三级视频 | 美女一区二区在线观看 | 久久人体视频 | 青草久久免费视频 | 日韩美香港a一级毛片免费 国产综合av | 日本a v在线播放 | 精品一区二区三区91 | 日韩一二三区视频 | 在线观看 亚洲 | 天天操 天天操 | 国产欧美精品区一区二区三区 | 久久久久久国产一区二区三区 | 国产原创在线观看 | 黄色免费在线观看网址 | 国产亚洲精品久久久优势 | 免费亚洲成人 | 欧美日韩一区二区三区在线观看 | 色888www视频在线观看 | 日韩免费中文字幕 | 综合九九| 国产精品久久精品 | 亚洲a在线观看 | 国产精品久久国产精品 | 免费看国产a | 亚洲国产成人精品女人久久久野战 | 一级大片 | 亚洲人人 | 日韩中文字幕 | 美女黄网| 欧美极品一区二区 | 中文字幕在线观看一区二区 | 国产一区2区 | 一级黄色片一级黄色片 | 亚洲影音先锋 | 精品国产一区二区三区久久 | 亚洲激情一区二区 | 国产精品一区二区在线观看 | 久久天天综合 |