简体   繁体   English

ImportError:无法加载共享库,请确保已安装librtmp

[英]ImportError: No shared library could be loaded, make sure that librtmp is installed

I am using Windows 8, and trying to work with python-librtmp. 我正在使用Windows 8,并尝试使用python-librtmp。 I have followed the steps to install librtmp from here: http://pythonhosted.org/python-librtmp/ . 我已经按照以下步骤从此处安装librtmp: http://pythonhosted.org/python-librtmp/ ://pythonhosted.org/python-librtmp/。 For me, the two pip install lines worked successfully when run in Windows Powershell. 对我而言,两条pip安装线在Windows Powershell中运行时可以成功运行。 After installation, it says the libraries are in c:\\python27\\lib\\site-packages . 安装后,它说这些库在c:\\python27\\lib\\site-packages

Now, I have opened a Python IDE (IDLE), and typed in import librtmp . 现在,我打开了Python IDE(IDLE),然后输入import librtmp This is giving me the following error: 这给了我以下错误:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import librtmp
  File "C:\Python27\lib\site-packages\librtmp\__init__.py", line 14, in <module>
    from librtmp_ffi.binding import librtmp
  File "C:\Python27\lib\site-packages\librtmp_ffi\binding.py", line 13, in <module>
    raise ImportError("No shared library could be loaded, "
ImportError: No shared library could be loaded, make sure that librtmp is installed.

The binding.py file: binding.py文件:

import librtmp_config

from .ffi import ffi
from .verifier import verifier

for path in librtmp_config.library_paths:
    try:
        librtmp = ffi.dlopen(path)
        break
    except OSError:
        pass
else:
    raise ImportError("No shared library could be loaded, "
                      "make sure that librtmp is installed.")

librtmp = verifier.load_library()

The init .py file in librtmp_config folder: librtmp_config文件夹中的init .py文件:

"""Runtime configuration of python-librtmp.

   This module provides access to variables used by this library
   and makes it possible to customize some behaviour before :mod:`librtmp`
   is imported.

"""
__all__ = ["library_paths"]

#: This is a list of filenames that python-librtmp
#: will attempt to dynamically load `librtmp` from.
library_paths = ["librtmp.so", "librtmp.so.0", "librtmp.dll", "librtmp.so.1", "librtmp.dylib"]

I am pretty new to Python, and this is the first time I am using Python in Windows. 我对Python很陌生,这是我第一次在Windows中使用Python。 When I installed librtmp, it said installation is successful. 当我安装librtmp时,它说安装成功。 I exactly followed the steps in the above link. 我完全按照上述链接中的步骤进行操作。 I cannot understand, then why it is saying make sure that librtmp is installed . 我不明白,然后为什么要说make sure that librtmp is installed

Is it some path issue or installation issue? 是路径问题还是安装问题? I search for a solution online, but nothing helped. 我在网上搜索解决方案,但没有任何帮助。

Do I need to install librtmp separately? 我需要单独安装librtmp吗? After some reading I found, librtmp is present in rtmpdump. 经过一番阅读,我发现rtmpdump中存在librtmp。 I have downloaded rtmpdump zip file from windows. 我已经从Windows下载了rtmpdump zip文件。 But I don't know how to install it. 但是我不知道如何安装。 README says, run "make SYS=mingw", but the zip folder has no makefile! 自述文件说,运行“ make SYS = mingw”,但zip文件夹中没有makefile!

But there is one subfolder in the rtmpdump folder. 但是rtmpdump文件夹中有一个子文件夹。 That folder contains librtmp.dll. 该文件夹包含librtmp.dll。 If you see above, the init .py mentions one librtmp.dll in its library path. 如果在上面看到, init .py在其库路径中提到一个librtmp.dll。 Does this mean, I have to refer to this .dll in the init .py. 这是否意味着,我必须在init .py中引用此.dll。 But I don't know how to do that. 但是我不知道该怎么做。

Can you please help? 你能帮忙吗?

Resolved!!! 解决!!! I copied librtmp.dll file from the rtmpdump package into C:\\Python27\\DLLs . 我将librtmp.dll包中的librtmp.dll文件复制到C:\\Python27\\DLLs From the binding.py and the _init_.py file content I figured, python is unable to locate the dll file. binding.py_init_.py我想通文件内容,蟒蛇是无法找到的DLL文件。 But, still I don't know why it could locate the file in the DLLs folder. 但是,我仍然不知道为什么它可以在DLLs文件夹中找到该文件。 I just tried it randomly, and it worked! 我只是随机尝试了,它奏效了!

If anyone of you can explain the logic it would be great! 如果你们中的任何人都能解释逻辑,那就太好了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 导入测试库“ SSHLibrary”失败,并出现ImportError“导入Paramiko库失败。 确保已安装Paramiko。” - Importing test library 'SSHLibrary' fails with the ImportError “Importing Paramiko library failed. Make sure you have Paramiko installed.” BigQuery ImportError:未加载 Dlopen(...) 库 - BigQuery ImportError: Dlopen(...) library not loaded ImportError:无法为 Python 导入 Cloud Firestore 库。确保安装“google-cloud-firestore”模块 - ImportError: Failed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module “找不到协议命令。 确保已安装protobuf并设置了PATH环境” - “Could not find protoc command. Make sure protobuf is installed and your PATH environment is set” PyGears 错误:找不到系统 libbz2 标头。 确保您的系统安装了 libz - PyGears Error: No system libbz2 headers could be found. Make sure your system has a libz installed 未安装Markdown库/ urllib ImportError - Markdown library isn't installed/urllib ImportError Scrapy错误--ImportError:库未加载 - Scrapy error--ImportError: Library not loaded 安装包(conda)会导致ImportError:Library未加载 - Installing a package (conda) results in ImportError: Library not loaded ImportError:未为 f2py 加载库 - ImportError: Library not loaded for f2py ImportError: MagickWand 未找到共享库[windows] - ImportError: MagickWand shared library not found[windows]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM