在目录['lib']中找不到库'radial'... LINK:致命错误LNK1181:无法打开输入文件'radial.lib' [英] could not find library 'radial' in directories ['lib']...LINK : fatal error LNK1181: cannot open input file 'radial.lib'

查看:140
本文介绍了在目录['lib']中找不到库'radial'... LINK:致命错误LNK1181:无法打开输入文件'radial.lib'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Python 3.7中有一些代码与Fortran FOR混合在一起.我使用Visual Studio 2019和Intel Parallel Studio 2019 Integrated.so,所以当我在Intel CMD python setup.py install中运行时,出现此错误:

I have some codes in Python 3.7 mixed with Fortran FOR . I use Visual Studio 2019 and Intel Parallel Studio 2019 integrated.so when I run in Intel CMD python setup.py install I got this error :

could not find library 'radial' in directories ['lib']...
LINK : fatal error LNK1181: cannot open input file 'radial.lib'
error: Command "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\link.exe...
… failed with exit status 1181

任何帮助将不胜感激.

setup.py:

#! /usr/bin/env python
# Last Change: Sun Dec 19 11:00 AM 2010 J

# Copyright (C) 2008 Alexander Vinokurov <alexander.a.vinokurov@gmail.com>

descr   = """ScattPy package.

ScattPy provides numerical methods for solving light scattering problem
by non-spherical particles.
"""

import os
import sys

DISTNAME            = 'scikits.scattpy'
DESCRIPTION         = 'Light Scattering methods for Python'
LONG_DESCRIPTION    = descr
MAINTAINER          = 'Alexander Vinokurov'
MAINTAINER_EMAIL    = 'scattpy@googlegroups.com'
URL                 = 'http://scattpy.github.com'
LICENSE             = 'BSD'
VERSION             = '0.1.2'
DOWNLOAD_URL        = 'http://github.com/downloads/ScattPy/scikits.scattpy/scikits.scattpy-'+VERSION+'.tar.gz'

import setuptools
from numpy.distutils.core import setup

def configuration(parent_package='', top_path=None, package_name=DISTNAME):
    if os.path.exists('MANIFEST'): os.remove('MANIFEST')

    from numpy.distutils.misc_util import Configuration
    config = Configuration(package_name, parent_package, top_path,
                           version = VERSION,
                           maintainer  = MAINTAINER,
                           maintainer_email = MAINTAINER_EMAIL,
                           description = DESCRIPTION,
                           license = LICENSE,
                           url = URL,
                           download_url = DOWNLOAD_URL,
                           long_description = LONG_DESCRIPTION)

    config.set_options(
        ignore_setup_xxx_py = True,
        assume_default_configuration = True,
        delegate_options_to_subpackages = True,
        quiet = True,
        )

#    config.add_subpackage("scikits")
#    config.add_data_files("scikits/__init__.py")

#    config.add_extension('f_utils',
#                         sources=[os.path.join('src', 'f_utils.for')]
#                         )

    config.add_extension('f_utils',
                         sources=[os.path.join('src', 'f_utils.for')]
                         )
    config.add_extension('f_spheroid',
                         sources=[os.path.join('src', 'sdmn.f')]
                         )

    config.add_extension('f_radial',
        sources=[os.path.join('src', 'radial.for')],
        library_dirs=["lib"],
        libraries=["radial"]
    )

    return config

if __name__ == "__main__":
    setup(configuration = configuration,
        install_requires = 'numpy',
        namespace_packages = ['scikits'],
        packages = setuptools.find_packages(),
        include_package_data = True,
        #test_suite="tester", # for python setup.py test
        zip_safe = True, # the package can run out of an .egg file
        classifiers =
            [ 'Development Status :: 4 - Beta',
              'Environment :: Console',
              'Intended Audience :: Developers',
              'Intended Audience :: Science/Research',
              'Intended Audience :: Education',
              'License :: OSI Approved :: BSD License',
              'Topic :: Scientific/Engineering :: Mathematics',
              'Topic :: Scientific/Engineering :: Physics',
              'Topic :: Scientific/Engineering :: Astronomy', ])

更新#2:

我的Intel CMD代码段:

有一些命令可能会使它无法正常工作,但是现在我不知道了:

There were some command maybe make it working wrong,but now I don't have any idea:

python setup.py install

    ...

compiling Fortran sources
Fortran f77 compiler: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe /nologo /MD /nbs /names:lowercase /assume:underscore /O1
Fortran f90 compiler: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe /nologo /MD /nbs /names:lowercase /assume:underscore /O1
Fortran fix compiler: C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe Files (x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe /nologo /MD /nbs /names:lowercase /assume:underscore /O1
compile options: '-Ibuild\src.win-amd64-3.7\build\src.win-amd64-3.7\scikits\scattpy -IC:\Users\admin\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\core\include -IC:\Users\admin\AppData\Local\Programs\Python\Python37\include -IC:\Users\admin\AppData\Local\Programs\Python\Python37\include -c'
ifort.exe:f77: build\src.win-amd64-3.7\scikits\scattpy\f_radial-f2pywrappers.f
ifort.exe:f77: src\radial.for
ifort: command line warininfg #ort: co10161: unrecognized source type 'Files'; object file assumed
mmand line warning #ifort: command line warning #10161: unrecognized source type '(x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe'; object file assumed
10161: unifort: command line warning #10006: ignoring unknown option '/c '
recognized source type 'Files'; object file assumed
ifort: command line warning #10161: unrecognized source type '(x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe'; object file assumed
ifort: command line warning #10006: ignoring unknown option '/c '
ifort: warning #10145: no action performed for file 'Files'
ifort: warning #10145: no action performed for file '(x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe'
ifort: warning #10145: no action performed for file 'Files'
ifort: warning #10145: no action performed for file '(x86)\IntelSWTools\compilers_and_libraries_2019.4.228\windows\bin\intel64\ifort.exe'
could not find library 'radial' in directories ['lib']
...
LINK : fatal error LNK1181: cannot open input file 'radial.lib'
...
failed with exit status 1181

更新#1:

我看到My Intel CMDSetup.py之间存在逻辑上的对应关系,如下所示,因此也许调整PATH即可解决问题:

As I see there is a logical corresponding relations between My Intel CMD and Setup.py as below,So maybe adjusting the PATH solve the problem:

My Intel CMD代码段:

My Intel CMD piece of code:

#1 ifort.exe:f77: src\radial.for

#2 could not find library 'radial' in directories ['lib']

setup.py:

with setup.py:

#1 sources=[os.path.join('src', 'radial.for')],

#2 library_dirs=["lib"], libraries=["radial"]

#2 library_dirs=["lib"], libraries=["radial"]

更新#2:

当我使用MINGW gfortran代替Intel Parallel Studio 2019并使用Microsoft Visual Studio Build Tools 2019代替Microsoft Vissual Studio 2019并使用latest version of Python时,请勿修改setup.py并进行一些更改,如<中的UPADTE#1和UPDATE#2 a href ="https://stackoverflow.com/questions/57150478/radial-o-error-lnk2001-unresolved-external-symbol-lambda-fatal-error-lnk1120"> radial.for 中的某些修改,我的问题解决了.

As I used MINGW gfortran instead of Intel Parallel Studio 2019 and used Microsoft Visual Studio Build Tools 2019 instead of Microsoft Vissual Studio 2019 and used latest version of Python , Do not Modifying setup.py and make some changes as UPADTE #1 and UPDATE #2 in Some modification in radial.for ,My problem Solved.

推荐答案

当我使用MINGW gfortran代替Intel Parallel Studio 2019并使用Microsoft Visual Studio Build Tools 2019代替Microsoft Vissual Studio 2019并使用latest version of Python时,请不要修改setup.py并在

As I used MINGW gfortran instead of Intel Parallel Studio 2019 and used Microsoft Visual Studio Build Tools 2019 instead of Microsoft Vissual Studio 2019 and used latest version of Python , Do not Modifying setup.py and make some changes as UPADTE #1 and UPDATE #2 in Some modification in radial.for ,My problem Solved.

这篇关于在目录['lib']中找不到库'radial'... LINK:致命错误LNK1181:无法打开输入文件'radial.lib'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆