lxml installed with conda: "ImportError: DLL load failed: The specified procedure could not be found"
lxml installed with conda: "ImportError: DLL load failed: The specified procedure could not be found"
我在 windows 10
上使用 anaconda
和最新版本的 conda 4.5.12
。我正在创建一个非常简单的测试环境来尝试使用 python 3.6.6
.
安装 lxml
这是我的 environment.yml 文件:
channels:
- defaults
dependencies:
- python=3.6.6
- lxml
然后我使用 conda 创建一个环境:
conda env create -f environment_test.yml -n test26
这里是安装后的包列表:
(test26) C:>conda list
# packages in environment at C:\Program Files\Anaconda3\envs\test26:
#
# Name Version Build Channel
certifi 2018.11.29 py36_0 defaults
libiconv 1.15 h1df5818_7 defaults
libxml2 2.9.8 hadb2253_1 defaults
libxslt 1.1.32 hf6f1972_0 defaults
lxml 4.2.5 py36hef2cd61_0 defaults
pip 18.1 py36_0 defaults
python 3.6.6 hea74fb7_0 defaults
setuptools 40.6.3 py36_0 defaults
vc 14.1 h0510ff6_4 defaults
vs2015_runtime 14.15.26706 h3a45250_0 defaults
wheel 0.32.3 py36_0 defaults
wincertstore 0.2 py36h7fe50ca_0 defaults
zlib 1.2.11 h62dcd97_3 defaults
到目前为止一切顺利。问题是当我尝试导入包 lxml
(test26) C:>python
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified procedure could not be found.
详细信息(另一个环境测试:"test29"):
>>> from lxml import etree
# C:\Program Files\Anaconda3\envs\test29\lib\site-packages\lxml\__pycache__\__init__.cpython-36.pyc matches C:\Program Files\Anaconda3\envs\test29\lib\site-packages\lxml\__init__.py
# code object from 'C:\Program Files\Anaconda3\envs\test29\lib\site-packages\lxml\__pycache__\__init__.cpython-36.pyc'
import 'lxml' # <_frozen_importlib_external.SourceFileLoader object at 0x00000160F1B643C8>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1023, in _handle_fromlist
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.
我该如何调试这个问题?我错过了依赖吗?
在 MacOS 上,我没有看到这个问题,所以它似乎特定于 Windows。 Windows 是否有旧版本(我试过 4.1.1 和 4.2.1)
环境是 created/activated 使用带有 Windows 10 的 Anaconda 提示,并且环境是通过以下命令激活的:
conda activate env test29
我们发现的一件事是,某些应用程序正在 C:\Windows\System32\ 下创建一些库,这是一种非常糟糕的做法。
最后我做了以下事情:
- 删除 C:\Windows\System32\libxml2.dll
- 删除 C:\Windows\System32\iconv.dll
这个环境一切正常,到目前为止,我的 Windows 应用程序出现了问题。感谢 Anaconda 团队的 Ray 的帮助。
我在 windows 10
上使用 anaconda
和最新版本的 conda 4.5.12
。我正在创建一个非常简单的测试环境来尝试使用 python 3.6.6
.
lxml
这是我的 environment.yml 文件:
channels:
- defaults
dependencies:
- python=3.6.6
- lxml
然后我使用 conda 创建一个环境:
conda env create -f environment_test.yml -n test26
这里是安装后的包列表:
(test26) C:>conda list
# packages in environment at C:\Program Files\Anaconda3\envs\test26:
#
# Name Version Build Channel
certifi 2018.11.29 py36_0 defaults
libiconv 1.15 h1df5818_7 defaults
libxml2 2.9.8 hadb2253_1 defaults
libxslt 1.1.32 hf6f1972_0 defaults
lxml 4.2.5 py36hef2cd61_0 defaults
pip 18.1 py36_0 defaults
python 3.6.6 hea74fb7_0 defaults
setuptools 40.6.3 py36_0 defaults
vc 14.1 h0510ff6_4 defaults
vs2015_runtime 14.15.26706 h3a45250_0 defaults
wheel 0.32.3 py36_0 defaults
wincertstore 0.2 py36h7fe50ca_0 defaults
zlib 1.2.11 h62dcd97_3 defaults
到目前为止一切顺利。问题是当我尝试导入包 lxml
(test26) C:>python
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified procedure could not be found.
详细信息(另一个环境测试:"test29"):
>>> from lxml import etree
# C:\Program Files\Anaconda3\envs\test29\lib\site-packages\lxml\__pycache__\__init__.cpython-36.pyc matches C:\Program Files\Anaconda3\envs\test29\lib\site-packages\lxml\__init__.py
# code object from 'C:\Program Files\Anaconda3\envs\test29\lib\site-packages\lxml\__pycache__\__init__.cpython-36.pyc'
import 'lxml' # <_frozen_importlib_external.SourceFileLoader object at 0x00000160F1B643C8>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1023, in _handle_fromlist
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.
我该如何调试这个问题?我错过了依赖吗?
在 MacOS 上,我没有看到这个问题,所以它似乎特定于 Windows。 Windows 是否有旧版本(我试过 4.1.1 和 4.2.1)
环境是 created/activated 使用带有 Windows 10 的 Anaconda 提示,并且环境是通过以下命令激活的:
conda activate env test29
我们发现的一件事是,某些应用程序正在 C:\Windows\System32\ 下创建一些库,这是一种非常糟糕的做法。 最后我做了以下事情:
- 删除 C:\Windows\System32\libxml2.dll
- 删除 C:\Windows\System32\iconv.dll
这个环境一切正常,到目前为止,我的 Windows 应用程序出现了问题。感谢 Anaconda 团队的 Ray 的帮助。