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

      <tfoot id='C1V5p'></tfoot><legend id='C1V5p'><style id='C1V5p'><dir id='C1V5p'><q id='C1V5p'></q></dir></style></legend>
    1. <small id='C1V5p'></small><noframes id='C1V5p'>

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

          <bdo id='C1V5p'></bdo><ul id='C1V5p'></ul>

        Python 錯誤:AttributeError:“模塊"對象沒有屬性

        Python error: AttributeError: #39;module#39; object has no attribute(Python 錯誤:AttributeError:“模塊對象沒有屬性)
      2. <tfoot id='uySb7'></tfoot>
          <bdo id='uySb7'></bdo><ul id='uySb7'></ul>
              <legend id='uySb7'><style id='uySb7'><dir id='uySb7'><q id='uySb7'></q></dir></style></legend>
                <i id='uySb7'><tr id='uySb7'><dt id='uySb7'><q id='uySb7'><span id='uySb7'><b id='uySb7'><form id='uySb7'><ins id='uySb7'></ins><ul id='uySb7'></ul><sub id='uySb7'></sub></form><legend id='uySb7'></legend><bdo id='uySb7'><pre id='uySb7'><center id='uySb7'></center></pre></bdo></b><th id='uySb7'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='uySb7'><tfoot id='uySb7'></tfoot><dl id='uySb7'><fieldset id='uySb7'></fieldset></dl></div>

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

                  <tbody id='uySb7'></tbody>

                1. 本文介紹了Python 錯誤:AttributeError:“模塊"對象沒有屬性的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我對 Python 完全陌生,我知道這個問題被問過很多次,但不幸的是,我的情況似乎有點不同......我已經創建了一個包(或者我認為).目錄樹是這樣的:

                  I'm totally new to Python and I know this question was asked many times, but unfortunately it seems that my situation is a bit different... I have created a package (or so I think). The catalog tree is like this:

                  mydir
                      lib   (__init__.py)
                          mod1  (__init__.py, mod11.py)
                  

                  括號中是目錄中的文件.兩個 __init__.py 文件都是零長度.

                  In parenthesis there are files in the catalog. Both __init__.py files are zero length.

                  文件 mydir/lib/mod1/mod11.py 包含以下內容:

                  The file mydir/lib/mod1/mod11.py contains the following:

                  def mod12():
                      print "mod12"
                  

                  現在,我運行 python,然后運行 ??import lib,運行正常,然后運行 ??lib.mod11()lib.mod12().

                  Now, I run python, then import lib, which works OK, then lib.mod11() or lib.mod12().

                  最后兩個中的任何一個都給了我主題錯誤消息.實際上,步驟 2 之后的 dir(lib) 也不顯示 mod11mod12 .看來我錯過了一些非常簡單的東西.

                  Either of the last two gives me the subject error message. Actually dir(lib) after Step 2 does not display mod11 or mod12 either. It seems I'm missing something really simple.

                  (我在 Ubuntu 10.10 中使用 Python 2.6)

                  (I'm using Python 2.6 in Ubuntu 10.10)

                  謝謝

                  推薦答案

                  當你 import lib 時,你正在導入包.在這種情況下,唯一要評估和運行的文件是 lib 目錄中的 0 字節 __init__.py.

                  When you import lib, you're importing the package. The only file to get evaluated and run in this case is the 0 byte __init__.py in the lib directory.

                  如果你想訪問你的函數,你可以執行類似 from lib.mod1 import mod1 的操作,然后像 mod1 那樣運行 mod12 函數.mod12().

                  If you want access to your function, you can do something like this from lib.mod1 import mod1 and then run the mod12 function like so mod1.mod12().

                  如果你想在導入lib的時候能夠訪問mod1,你需要在里面放一個import mod1lib 目錄中的 __init__.py 文件.

                  If you want to be able to access mod1 when you import lib, you need to put an import mod1 inside the __init__.py file inside the lib directory.

                  這篇關于Python 錯誤:AttributeError:“模塊"對象沒有屬性的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

                  python: Two modules and classes with the same name under different packages(python:不同包下同名的兩個模塊和類)
                  Configuring Python to use additional locations for site-packages(配置 Python 以使用站點包的其他位置)
                  How to structure python packages without repeating top level name for import(如何在不重復導入頂級名稱的情況下構造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(分發帶有已編譯動態共享庫的 Python 包)
                    <tbody id='R2b5v'></tbody>

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

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

                        • <bdo id='R2b5v'></bdo><ul id='R2b5v'></ul>
                          • 主站蜘蛛池模板: 久久99国产精品久久99果冻传媒 | 一级片片 | 91精品国产91久久综合桃花 | 久在线 | 精品一二区 | 91精品国产欧美一区二区成人 | 亚洲福利一区二区 | 欧美在线亚洲 | 日韩视频区 | 久久精品视频91 | 国产99久久精品一区二区300 | 亚洲在线电影 | 成人性视频在线 | 日韩视频中文字幕 | 国产精品视频一 | 国产日韩91| 成人免费看片 | 日本三级在线视频 | 九九综合九九 | av入口 | 久久视频免费看 | 999精品视频 | 男女视频在线观看 | 日韩在线精品视频 | 国产精品精品3d动漫 | 欧美成人一级 | 久久国产精品一区 | 一区二区三区欧美在线观看 | 日韩国产免费 | 国产高清视频一区 | 亚洲激情在线观看 | 精品综合久久久 | 在线成人 | 中文字幕免费在线 | 精品国产欧美 | 国产精品成人在线播放 | 亚洲国产日韩一区 | 成人毛片视频在线播放 | www.色婷婷 | 亚洲国产精品一区二区久久 | 欧美天堂 |