首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >即使在python中安装libarchive之后也会出现libarchive.public错误

即使在python中安装libarchive之后也会出现libarchive.public错误
EN

Stack Overflow用户
提问于 2015-03-24 05:45:58
回答 1查看 2.5K关注 0票数 0

当我试图执行导入libarchive.public时,我收到了一个错误。下面是日志文本。我已经安装了libarchive使用pip安装libarchive。help命令显示库中存在公共模块,但导入时仍会出现错误。有人能帮我解决这个错误吗?我想我做的一切都是正确的。

代码语言:javascript
复制
WindowsError                              Traceback (most recent call last)
<ipython-input-10-bd7a0027d55f> in <module>()
----> 1 import libarchive.public

C:\Users\soumya\AppData\Local\Enthought\Canopy\User\lib\site-packages\libarchive\public.py in <module>()
----> 1 from libarchive.adapters.archive_read import       2     file_enumerator, file_reader, file_pour,       3     memory_enumerator, memory_reader, memory_pour
      4 
      5 from libarchive.adapters.archive_write import 
C:\Users\soumya\AppData\Local\Enthought\Canopy\User\lib\site-packages\libarchive\adapters\archive_read.py in <module>()
      5 import libarchive.constants.archive
      6 import libarchive.exception
----> 7 import libarchive.calls.archive_read
      8 import libarchive.calls.archive_write
      9 import libarchive.calls.archive_general

C:\Users\soumya\AppData\Local\Enthought\Canopy\User\lib\site-packages\libarchive\calls\archive_read.py in <module>()
      1 from ctypes import *
      2 
----> 3 from libarchive.library import libarchive
      4 from libarchive.types.archive import *
      5 from libarchive.constants.archive import *

C:\Users\soumya\AppData\Local\Enthought\Canopy\User\lib\site-packages\libarchive\library.py in <module>()
     14 
     15 _logger.debug("Using library: [%s]", _FILEPATH)
---> 16 libarchive = ctypes.cdll.LoadLibrary(_FILEPATH)

C:\Users\soumya\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.1.2730.win-x86_64\lib\ctypes\__init__.pyc in LoadLibrary(self, name)
    441 
    442     def LoadLibrary(self, name):
--> 443         return self._dlltype(name)
    444 
    445 cdll = LibraryLoader(CDLL)

C:\Users\soumya\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.5.1.2730.win-x86_64\lib\ctypes\__init__.pyc in __init__(self, name, mode, handle, use_errno, use_last_error)
    363 
    364         if handle is None:
--> 365             self._handle = _dlopen(self._name, mode)
    366         else:
    367             self._handle = handle

WindowsError: [Error 126] The specified module could not be found 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-27 00:01:35

代码语言:javascript
复制
I had to do it on Linux Mint as I could not find a solution for windows. The modified answer is below.

# Install compiler and tools
$ sudo apt-get install build-essential libtool python-dev

# Install cmake
$ sudo apt-get install cmake

$ wget https://github.com/libarchive/libarchive/releases/download/v3.4.1/libarchive-3.4.1.tar.xz
$ tar -xJf libarchive-3.4.1.tar.xz

# Configure using cmake...
$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../libarchive-3.4.1

# Now compile and install...
$ make
$ sudo make install

$ sudo sh -c 'echo /usr/local/lib > /etc/ld.so.conf.d/libarchive3.conf'
$ sudo ldconfig

$pip install python-libarchive

最新的libarchive下载链接可在以下网址上找到:http://www.linuxfromscratch.org/blfs/view/svn/general/libarchive.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29225812

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档