找不到指定的过程

找不到指定的过程

本文介绍了安装了conda的lxml:"ImportError:DLL加载失败:找不到指定的过程"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows 10 上使用最新版本的conda 4.5.12 上的 anaconda .我正在创建一个非常简单的测试环境,尝试使用 python 3.6.6 安装 lxml .

I am using anaconda on windows 10 with the lastest version of conda 4.5.12. I am creating a very simple test env to try to install lxml with python 3.6.6.

这是我的environment.yml文件:

Here my environment.yml file:

channels:
- defaults
dependencies:
- python=3.6.6
- lxml

然后我使用conda创建一个环境:

Then I create an env using conda:

conda env create -f environment_test.yml -n test26

以下是安装后的软件包列表:

Here the list of packages after the installation:

(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

So far so good. The issue is when I tried to import the package 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.

具有详细信息(另一个带有env的测试:"test29"):

With verbose info (another test with env: "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.

如何调试此问题?我会错过依赖吗?

How can I debug this issue ? Do I missed dependency ?

在MacOS上,我没有看到此问题,因此它似乎特定于Windows.Windows上是否有较旧的版本(我尝试过4.1.1和4.2.1)

On MacOS, I don't see the issue so it seems specific to Windows. Is there an older version working on Windows (I tried 4.1.1 and 4.2.1)

使用Windows 10的Anaconda提示创建/激活环境,并使用以下方法激活环境:

The env is created/activated using the Anaconda prompt with Windows 10 and the env is activated with:

conda activate env test29

推荐答案

我们发现的一件事是,某些应用程序正在C:\ Windows \ System32 \下创建一些lib,这是非常糟糕的做法.最后,我执行了以下操作:

One of the thing we discover is that some applications are creating some lib under C:\Windows\System32\ and this is a very bad practice.At the end I did the following:

  1. 删除C:\ Windows \ System32 \ libxml2.dll
  2. 删除C:\ Windows \ System32 \ iconv.dll

一切都与此环境兼容,到目前为止,我的Windows应用程序出现了问题.感谢Anaconda团队的Ray.

Everything is working well with this env and so far I got now issue with my Windows applicarions. Thanks to Ray from the Anaconda team for the help.

这篇关于安装了conda的lxml:"ImportError:DLL加载失败:找不到指定的过程"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 00:51