f2py

    0熱度

    1回答

    我想在我的系統中使用f2py安裝一些Python模塊,這些模塊與海洋模型(在Fortran 90中)有關。我正面臨f2py的一些問題。具體而言,即使我安裝了所需的庫和包含文件,f2py也無法與NetCDF庫鏈接。我在64位機器上的Ubuntu16.04上使用Python 2.7與Anaconda 2。我正在使用gfortran。 爲了測試它的工作情況,我編寫了一個小代碼 - 一個包含一個小子程序的

    1熱度

    1回答

    我正在使用帶有Python 3內核的Jupyter筆記本。 如果我運行: import scipy.optimize scipy.optimize.minimize( lambda _: 1, 0, method='COBYLA', options={'iprint': 1, 'disp': True, 'maxiter': 2}) 我期望能獲得打印到I

    0熱度

    1回答

    我有一個子程序,我在Fortran中編寫與f2py編譯和編譯失敗。我不會在這裏發佈完整的子程序但MWE是: SUBROUTINE mwe(Vars, nxc, nyc, vCorr) IMPLICIT NONE real(kind=8), dimension(:,:,:,:) :: Vars integer :: nxc, nyc integer :: dims(4), nv, nt, n

    1熱度

    1回答

    如果我打算將一個布爾型的NumPy數組與f2py一起傳遞給Fortran變量,應該如何輸入?我已嘗試integer*1和logical*1,但這些都表明數組已被複制。 例如,如果我編譯文件,foo.f95,包含: subroutine foo(x, n) logical*1 x(n) !f2py intent(in) x !f2py intent(hide), dep

    0熱度

    1回答

    f2py爲了建立使用python2 f2py擴展模塊,我一直在使用一個Makefile類似於: default: fortran_lib.so %.so:: %.f90 f2py -c -m $* $< 爲了完整起見,這裏也是一個虛擬fortran_lib.f90文件 subroutine square(d) implicit none !f2py intent(inout)

    0熱度

    1回答

    說我有一個模塊通過f2py編譯負指數編譯: test.f90 module test implicit none integer, parameter :: q = 2 real(8), parameter, dimension(-q:q) :: vec = (/ 1, 2, 3, 4, 5 /) contains subroutine writevec() write(

    0熱度

    1回答

    我的最終目標是獲取我編寫的許多不同的Fortran腳本,並通過Python將它們連接起來。腳本本身相對簡單:基本上,只是很多數學,沒有任何編程結構比數組更復雜。不過,我很新,所以我有一個小測試腳本,我正在嘗試。 主要腳本下面是(以縮寫形式): subroutine addwake use geometry implicit none integer::i,j,k,m re

    1熱度

    1回答

    我想用f2py編譯一個fortran模塊。這是下面的代碼 module my_log_mod implicit none interface my_log module procedure my_log_array module procedure my_log_vector end interface my_log priva

    0熱度

    1回答

    我正在運行OpenSuse 42.3,並且我使用pip install numpy安裝了numpy 1.13.1。 我運行命令: f2py -c PDFF.f -m PDFF 我得到的錯誤: 錯誤:文件 '/usr/lib64/python2.7/site-packages/numpy/f2py/src/fortranobject.c' 不不存在 如果我在該目錄上執行了ls,則在f2py的/

    0熱度

    1回答

    我在包裝一些Fortran子程序以用於python3腳本時遇到了一個問題。自從我試圖在子例程中使用OpenMP後,此問題纔出現。 例如,如果我使用f2py -c -m --fcompiler=gfortran --compiler=mingw32 --f90flags='-fopenmp' test test.f90 -lgomp編譯模塊'test.pyd',其中'test.f90'是包含並行循環