Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何让setup.py test使用特定的fortran编译器?_Python_Fortran_Setuptools_Distutils - Fatal编程技术网

Python 如何让setup.py test使用特定的fortran编译器?

Python 如何让setup.py test使用特定的fortran编译器?,python,fortran,setuptools,distutils,Python,Fortran,Setuptools,Distutils,我正在尝试测试一个包含一些f90文件的文件。如果我构建或安装并指定fortran编译器,它就可以正常工作。但是,当我尝试进行测试时,会出现以下错误: C:\Users\jsalvatier\workspace\scikits.bvp_solver>python setup.py config_fc --fcompiler=gfortran test running config_fc unifing config_fc, config, build_clib, build_ext, bui

我正在尝试测试一个包含一些f90文件的文件。如果我构建或安装并指定fortran编译器,它就可以正常工作。但是,当我尝试进行测试时,会出现以下错误:

C:\Users\jsalvatier\workspace\scikits.bvp_solver>python setup.py config_fc --fcompiler=gfortran test
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running test
running egg_info
running build_src
build_src
building extension "scikits.bvp_solver.bvp_solverf" sources
f2py options: []
  adding 'build\src.win32-2.6\fortranobject.c' to sources.
  adding 'build\src.win32-2.6' to include_dirs.
  adding 'build\src.win32-2.6\scikits\bvp_solver\lib\bvp_solverf-f2pywrappers2.f90' to sources.
building data_files sources
build_src: building npy-pkg config files
writing scikits.bvp_solver.egg-info\PKG-INFO
writing namespace_packages to scikits.bvp_solver.egg-info\namespace_packages.txt
writing top-level names to scikits.bvp_solver.egg-info\top_level.txt
writing dependency_links to scikits.bvp_solver.egg-info\dependency_links.txt
reading manifest file 'scikits.bvp_solver.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'scikits.bvp_solver.egg-info\SOURCES.txt'
running build_ext
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
customize GnuFCompiler
Found executable C:\mingw\bin\g77.exe
gnu: no Fortran 90 compiler found
gnu: no Fortran 90 compiler found
Found executable C:\mingw\bin\g77.exe
customize GnuFCompiler
gnu: no Fortran 90 compiler found
gnu: no Fortran 90 compiler found
customize GnuFCompiler using build_ext
building 'scikits.bvp_solver.bvp_solverf' extension
compiling C sources
C compiler: gcc -mno-cygwin -O2 -Wall -Wstrict-prototypes

compile options: '-Ibuild\src.win32-2.6 -IC:\Python26\lib\site-packages\numpy\core\include -IC:\Python26\include -IC:\Python26\PC -c'
gcc -mno-cygwin -O2 -Wall -Wstrict-prototypes -Ibuild\src.win32-2.6 -IC:\Python26\lib\site-packages\numpy\core\include -IC:\Python26\include -IC:\Python26\PC -c build\src.win32-2.6\scikits\bvp_solver\lib\bvp_solverfmodule.c -o build\temp.win32-2.6\Release\build\src.win32-2.6\scikits\bvp_solver\lib\bvp_solverfmodule.o
Found executable C:\mingw\bin\gcc.exe
gcc -mno-cygwin -O2 -Wall -Wstrict-prototypes -Ibuild\src.win32-2.6 -IC:\Python26\lib\site-packages\numpy\core\include -IC:\Python26\include -IC:\Python26\PC -c build\src.win32-2.6\fortranobject.c -o build\temp.win32-2.6\Release\build\src.win32-2.6\fortranobject.o
compiling Fortran 90 module sources
XXX: module_build_dir='build\\temp.win32-2.6\\Release\\scikits\\bvp_solver' option ignored
XXX: Fix module_dir_switch for  GnuFCompiler
XXX: module_dirs=[] option ignored
XXX: Fix module_include_switch for  GnuFCompiler
Fortran f77 compiler: C:\mingw\bin\g77.exe -g -Wall -fno-second-underscore -mno-cygwin -O3 -funroll-loops
compile options: '-Ibuild\src.win32-2.6 -IC:\Python26\lib\site-packages\numpy\core\include -IC:\Python26\include -IC:\Python26\PC -c'
error: f90 not supported by GnuFCompiler needed for scikits\bvp_solver\lib\BVP_M.f90
有办法解决这个问题吗?我使用的是windows 7、python 2.6、numpy 1.4.1。

该软件包的建议构建如下:

python setup.py config --compiler=mingw32 build --compiler=mingw32 install
这应该适用于gfortran的mingw32版本。我没有可访问的Windows计算机,但当我使用gfortran构建其他Python模块(例如numpy)时,该命令类似于:

python setup.py build --fcompiler=gnu95

埃塔:我误解了你问题的开头,现在我看到你可以构建但不能测试。您是否仅使用“-compiler=mingw32”尝试过此操作?

我认为问题在于“test”命令需要在原地构建

python setup.py config --fcompiler=gfortran build_ext --inplace
正在生成与以前相同的错误,但是

python setup.py config --fcompiler=gfortran build_ext
没有

我可以通过以下方式解决这个问题:

  • 在interactive中运行安装程序 模式(python setup.py)

  • 将fortran编译器设置为gfortran

  • 选择就地构建(3)


  • 您使用的是gfortran还是g95?另外,F90编译器安装在哪里?我正在使用gfortran,尽管我可以安装g95。gfortran安装在C:\MinGW\b中。我建议使用gfortran。我只是想确定你真的在使用gfortran;人们经常会对g95和gfortran感到困惑。不幸的是,它没有起作用。有趣的是,python setup.py config--fcompiler=gfortran build_ext--inplace不起作用,但是python setup.py config--fcompiler=gfortran build_ext起作用,我认为这可能是问题的根源,因为我认为“test”必须在原地构建。python setup.py build--fcompiler=gnu95非常适合在ubuntu 11.10中安装scipy。我找了一整天,这就是我的解决办法。