Python dosyalarında kullanmak istediğim bazı Fortran dosyaları var. C: \ Python27 \ python.exe setup.py build_ext --inplace --fcompiler = g95 komutunu kullandım. Benim setup.py dosyası aşağıdaki kodu içerir:Numpy kurulum hatası: ek resmi argüman
import sys, os
extra_link_args = []
extra_link_args = ['-framework', 'accelerate']
from numpy.distutils.core import setup, Extension
opt_flags = ['-g', '-fbounds-check', '-I/usr/include/']
files1 = ['particle_solvers/fbsl_sim_fmod.f90',
'particle_solvers/fbsl_parts_fmod.f90',
'particle_solvers/fbsl_poisson_fmod.f90',
'particle_solvers/fbsl_convol_fmod.f90',
'particle_solvers/fbsl_lbfr_parts_fmod.f90',
'particle_solvers/fbsl_ltp_parts_fmod.f90',
'particle_solvers/fbsl_pusher_fmod.f90',
]
ext1 = Extension(name='_fbsl_f90',
sources=files1,
extra_compile_args=opt_flags,
extra_link_args=extra_link_args)
setup(name="_fbsl_f90",
version='0.1',
description="Hidden",
author="Hidden",
author_email='Hidden',
url='',
ext_modules=[ext1])
Ama şu hataları var:
g95.exe:f90: build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:211
&ef2pywrap, smooth_heaviside, r)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_smooth_heaviside' at (1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:13
&nf2pywrap, t)
1
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:217
&nf2pywrap, f_exact_is_known, t)
2
Error: Differing types REAL(8) and LOGICAL(4) in formal arguments at (1) and (2)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:223
&inal_is_knownf2pywrap, f_exact_final_is_known)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_f_exact_final_is_known'
at (1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:228
&2pywrap, f_exact_initial, eta_0, eta_1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_f_exact_initial' at (1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:235
&, t, eta_0, eta_1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_f_exact' at (1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:243
&rap, f_exact_final, eta_0, eta_1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_f_exact_final' at (1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:250
&_field_is_givenf2pywrap, velocity_field_is_given)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_velocity_field_is_given'
at (1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:255
&ine_u0, x0, x1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_affine_u0' at (1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:262
&ine_u1, x0, x1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_affine_u1' at (1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:269
&p, quadratic_u0, t, x0, x1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_quadratic_u0' at (1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:277
&p, quadratic_u1, t, x0, x1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_quadratic_u1' at (1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:285
&w_0f2pywrap, bwd_affine_flow_0, t, x0, x1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_bwd_affine_flow_0' at (1
)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:293
&w_1f2pywrap, bwd_affine_flow_1, t, x0, x1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_bwd_affine_flow_1' at (1
)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:301
&ic_flow_0f2pywrap, bwd_quadratic_flow_0, t, x0, x1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_bwd_quadratic_flow_0' at
(1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:309
&ic_flow_1f2pywrap, bwd_quadratic_flow_1, t, x0, x1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_bwd_quadratic_flow_1' at
(1)
In file build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90:317
&0, x1)
1
Error: Extra formal argument for 'f2pywrap_fbsl_sim_f90_bggk_a' at (1)
error: Command "C:\Users\QUENTIN\bin\g95.exe -fno-second-underscore -O -Ibuild\s
rc.win32-2.7 -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\in
clude -IC:\Python27\PC -c -c build\src.win32-2.7\_fbsl_f90-f2pywrappers2.f90 -o
build\temp.win32-2.7\Release\build\src.win32-2.7\_fbsl_f90-f2pywrappers2.o -fmod
=build\temp.win32-2.7\Release\ -Ibuild\temp.win32-2.7\Release\" failed with exit
status 1
O Ekstra resmi argüman hataları neden anlamıyorum. Onları nasıl düzeltebilirim? Windows 7 üzerinde Python 2.7 ve g95 derleyici ile çalışıyorum.
DÜZENLEME:
module test_f90
implicit none
real *8 :: delta
contains
real*8 function test_f(r)
real*8, intent(in) :: r
test_f = 0.5*(1 + erf(r/delta))
end function
end module test_f90
komut C kullandığınızda: \ Python27 \ python.exe setup.py build_ext --inplace --fcompiler Tamam, basitleştirmek için, burada benim Fortran kod bir örnektir = Bu setup.py dosyası ile G95:
! -*- f90 -*-
! This file is autogenerated with f2py (version:2)
! It contains Fortran 90 wrappers to fortran functions.
subroutine f2pywrap_test_f90_test_f (test_ff2pywrap, r)
use test_f90, only : test_f
real(kind=8) r
real(kind=8) test_ff2pywrap
test_ff2pywrap = test_f(r)
end subroutine f2pywrap_test_f90_test_f
subroutine f2pyinittest_f90(f2pysetupfunc)
use test_f90, only : delta
interface
subroutine f2pywrap_test_f90_test_f (test_ff2pywrap, test_f, r)
real(kind=8) test_f
real(kind=8) r
real(kind=8) test_ff2pywrap
end subroutine f2pywrap_test_f90_test_f
end interface
external f2pysetupfunc
call f2pysetupfunc(delta,f2pywrap_test_f90_test_f)
end subroutine f2pyinittest_f90
bu: Ben f2py tarafından oluşturulan bu Fortran dosyayı var
import sys
extra_link_args = []
from numpy.distutils.core import setup, Extension
opt_flags = ['-g', '-fbounds-check', '-I/usr/include/']
files1 = ['test_fmod.f90',
]
ext1 = Extension(name='_test_f90',
sources=files1,
extra_compile_args=opt_flags,
extra_link_args=extra_link_args)
setup(name="_test_f90",
version='0.1',
description="test module",
author="Hidden",
author_email='Hidden',
url='',
ext_modules=[ext1])
2 ardından 3 resmi argümanları ilk: bu çelişkili imzalarla iki kez bir işlev beyan olarak
g95.exe:f90: build\src.win32-2.7\_test_f90-f2pywrappers2.f90
In file build\src.win32-2.7\_test_f90-f2pywrappers2.f90:15
subroutine f2pywrap_test_f90_test_f (test_ff2pywrap, test_f, r)
1
Error: Extra formal argument for 'f2pywrap_test_f90_test_f' at (1)
error: Command "C:\Users\QUENTIN\bin\g95.exe -fno-second-underscore -O -Ibuild\s
rc.win32-2.7 -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\in
clude -IC:\Python27\PC -c -c build\src.win32-2.7\_test_f90-f2pywrappers2.f90 -o
build\temp.win32-2.7\Release\build\src.win32-2.7\_test_f90-f2pywrappers2.o -fmod
=build\temp.win32-2.7\Release\ -Ibuild\temp.win32-2.7\Release\" failed with exit
status 1
Bu hatalar, Fortran alt yordamlarını yanlış çağırmasından kaynaklanıyor gibi görünüyor. Tabii ki, bu sadece bir tahmindir çünkü bize kodu göstermediniz. –
Lütfen bize bu hatalarla sonuçlanan Fortran kodunu göster. – Ares
Gönderiyi bir Fortran kodumla düzenledim – Vegeson