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

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

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

    <legend id='HDax9'><style id='HDax9'><dir id='HDax9'><q id='HDax9'></q></dir></style></legend>

    <tfoot id='HDax9'></tfoot>

    1. <i id='HDax9'><tr id='HDax9'><dt id='HDax9'><q id='HDax9'><span id='HDax9'><b id='HDax9'><form id='HDax9'><ins id='HDax9'></ins><ul id='HDax9'></ul><sub id='HDax9'></sub></form><legend id='HDax9'></legend><bdo id='HDax9'><pre id='HDax9'><center id='HDax9'></center></pre></bdo></b><th id='HDax9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='HDax9'><tfoot id='HDax9'></tfoot><dl id='HDax9'><fieldset id='HDax9'></fieldset></dl></div>
    2. Python - C 嵌入式分段錯誤

      Python - C embedded Segmentation fault(Python - C 嵌入式分段錯誤)

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

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

              • <legend id='jD1D6'><style id='jD1D6'><dir id='jD1D6'><q id='jD1D6'></q></dir></style></legend>
                <i id='jD1D6'><tr id='jD1D6'><dt id='jD1D6'><q id='jD1D6'><span id='jD1D6'><b id='jD1D6'><form id='jD1D6'><ins id='jD1D6'></ins><ul id='jD1D6'></ul><sub id='jD1D6'></sub></form><legend id='jD1D6'></legend><bdo id='jD1D6'><pre id='jD1D6'><center id='jD1D6'></center></pre></bdo></b><th id='jD1D6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='jD1D6'><tfoot id='jD1D6'></tfoot><dl id='jD1D6'><fieldset id='jD1D6'></fieldset></dl></div>
              • <tfoot id='jD1D6'></tfoot>
                  <tbody id='jD1D6'></tbody>
                本文介紹了Python - C 嵌入式分段錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我面臨類似于 Py_initialize/Py_Finalize 的問題不能用 numpy 工作兩次 .. C 中的基本編碼:

                I am facing a problem similar to the Py_initialize / Py_Finalize not working twice with numpy .. The basic coding in C:

                Py_Initialize();
                import_array();
                //Call a python function which imports numpy as a module
                //Py_Finalize()
                

                程序處于循環中,如果 python 代碼將 numpy 作為導入的模塊之一,它會給出段錯誤.如果我刪除 numpy,它工作正常.

                The program is in a loop and it gives a seg fault if the python code has numpy as one of the imported module. If I remove numpy, it works fine.

                作為臨時解決方法,我嘗試不使用 Py_Finalize(),但這會導致巨大的內存泄漏 [隨著 TOP 的內存使用量不斷增加而觀察到].我試過但不明白我發布的那個鏈接中的建議.有人可以建議在導入諸如 numpy 的同時完成通話的最佳方法.

                As a temporary work around I tried not to use Py_Finalize(), but that is causing huge memory leaks [ observed as the memory usage from TOP keeps on increasing ]. And I tried but did not understand the suggestion in that link I posted. Can someone please suggest the best way to finalize the call while having imports such as numpy.

                謝謝桑托什

                推薦答案

                我不太確定您似乎不理解 Py_initialize/Py_Finalize 不能與 numpy 一起工作兩次.發布的解決方案非常簡單:每次程序執行時只調用 Py_Initialize 和 Py_Finalize 一次.不要在每次運行循環時都調用它們.

                I'm not quite sure how you don't seem to understand the solution posted in Py_initialize / Py_Finalize not working twice with numpy. The solution posted is quite simple: call Py_Initialize and Py_Finalize only once for each time your program executes. Do not call them every time you run the loop.

                我假設您的程序在啟動時會運行一些初始化命令(僅運行一次).在那里調用 Py_Initialize.永遠不要再調用它.另外,我假設當你的程序終止時,它有一些代碼可以刪除東西、轉儲日志文件等.在那里調用 Py_Finalize.Py_Initialize 和 Py_Finalize 并非旨在幫助您管理 Python 解釋器中的內存.不要為此使用它們,因為它們會導致您的程序崩潰.相反,請使用 Python 自己的函數來刪除您不想保留的對象.

                I assume that your program, when it starts, runs some initialization commands (which are only run once). Call Py_Initialize there. Never call it again. Also, I assume that when your program terminates, it has some code to tear down things, dump log files, etc. Call Py_Finalize there. Py_Initialize and Py_Finalize are not intended to help you manage memory in the Python interpreter. Do not use them for that, as they cause your program to crash. Instead, use Python's own functions to get rid of objects you don't want to keep.

                如果您確實必須在每次運行代碼時創建一個新環境,您可以使用 Py_NewInterpreter 并創建一個子解釋器,然后使用 Py_EndInterpreter 來銷毀該子解釋器.它們記錄在 Python C API 頁面底部附近.這類似于擁有一個新的解釋器,除了每次啟動子解釋器時不會重新初始化模塊.

                If you really MUST create a new environment every time you run your code, you can use Py_NewInterpreter and to create a sub-interpreter and Py_EndInterpreter to destroy that sub-interpreter later. They're documented near the bottom of the Python C API page. This works similarly to having a new interpreter, except that modules are not re-initialized each time a sub-interpreter starts.

                這篇關于Python - C 嵌入式分段錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)

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

                      <tfoot id='HVtqn'></tfoot>

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

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

                          <legend id='HVtqn'><style id='HVtqn'><dir id='HVtqn'><q id='HVtqn'></q></dir></style></legend>
                        1. 主站蜘蛛池模板: 国产精品久久久久一区二区三区 | 久草福利 | 日韩精品一区二区三区 | 黄频免费 | 成年免费大片黄在线观看岛国 | 亚洲精品中文字幕在线观看 | 在线播放中文字幕 | 7799精品视频天天看 | 亚洲一区二区三区在线播放 | 国产精品无码专区在线观看 | 欧美久久久久久久久中文字幕 | 精品国产99| 亚洲不卡在线观看 | 九九九色 | 瑞克和莫蒂第五季在线观看 | 爱爱小视频 | 欧美精品一区二区三区蜜臀 | 亚洲精品一区中文字幕 | 人人爱干| 亚洲成av| 亚洲精品二区 | 在线观看中文字幕av | 久久天天躁狠狠躁夜夜躁2014 | 欧美日韩国产精品一区 | 成人午夜免费福利视频 | 91精品久久久久久综合五月天 | 日本精品视频 | 91资源在线播放 | 一级无毛片 | 国产三区视频在线观看 | 97起碰| 免费h视频 | 精品成人佐山爱一区二区 | 国产精品久久欧美久久一区 | 国产成人免费视频网站视频社区 | 国产永久免费 | 欧美11一13sex性hd | 国产成人高清成人av片在线看 | 91精品一区 | 国产精品久久久久久婷婷天堂 | 久久毛片 |