当我尝试导入libarchive.public 时出现错误。以下是日志文本。我使用pip install libarchive安装了libarchive。 help命令显示库中是否存在公共模块,但导入时仍然会出错。任何人都可以帮我解决这个错误。我想我已经做好了一切。
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
答案 0 :(得分:0)
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 http://libarchive.googlecode.com/files/libarchive-3.1.2.tar.gz
$ tar xzf libarchive-3.1.2.tar.gz
# Configure using cmake...
$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local ../libarchive-3.1.2
# 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