从内部环境调用python.exe时DLL导入错误

时间:2020-01-07 13:32:27

标签: python-3.x tensorflow anaconda conda imutils

我有一个tensorflow-gpu 1.13.1的Anaconda环境设置。它在Anaconda Powershell中运行良好,当我在环境文件夹中调用python.exe时,它运行良好,例如:

...\AppData\Local\Continuum\anaconda3\envs\tensorflow113\python.exe myscript.py

此后,我创建了一个新环境,在其中安装了tensorflow-gpu 1.15版(并且我也尝试过1.14版)。这在Anaconda Powershell中运行良好,但是当我尝试从此环境文件夹运行python.exe时,它将引发导入dll错误。我需要它在不使用Anaconda Powershell的情况下工作。

我已经通过Google进行了爬网,通常可以通过更改一些路径变量或移动文件来修复一个dll错误,但是我只是遇到另一个dll导入错误,这只是在避免而不是修复问题。

我能想到的一件事是,我还在环境中安装了imutils和pyzmq,我想我现在正在从不同的地方(从anaconda forge)获得它们。

示例dll错误:

Traceback (most recent call last):
  File "F:/Unity/Projects/Particle/Assets/DEW/PythonDetection/PythonTensorflow.py", line 1, in <module>
    from imutils.video import VideoStream
  File "C:\Users\<user>\AppData\Local\Continuum\anaconda3\envs\Waterfall\lib\site-packages\imutils\__init__.py", line 8, in <module>
    from .convenience import translate
  File "C:\Users\<user>\AppData\Local\Continuum\anaconda3\envs\Waterfall\lib\site-packages\imutils\convenience.py", line 6, in <module>
    import cv2
ImportError: DLL load failed: The specified module could not be found.

“修复” dll导入错误后出现错误:

2020-01-07 13:24:15.330786: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
2020-01-07 13:24:15.331097: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Segmentation fault

我导入的工作tensorflow 1.13.0:

# Name                    Version                   Build  Channel
_tflow_select             2.1.0                       gpu
absl-py                   0.7.1                    py36_0
astor                     0.7.1                    py36_0
autopep8                  1.4.4                    pypi_0    pypi
blas                      1.0                         mkl
ca-certificates           2019.3.9             hecc5488_0    conda-forge
certifi                   2019.3.9                 py36_0    conda-forge
clangdev                  8.0.0                h1ad3211_2    conda-forge
cudatoolkit               10.0.130                      0
cudnn                     7.3.1                cuda10.0_0
gast                      0.2.2                    py36_0
grpcio                    1.16.1           py36h351948d_1
h5py                      2.9.0            py36h5e291fa_0
hdf5                      1.10.4               h7ebc959_0
icc_rt                    2019.0.0             h0cc432a_1
icu                       58.2                 ha66f8fd_1
imutils                   0.4.6                    py36_0    pjamesjoyce
intel-openmp              2019.3                      203
jpeg                      9b                   hb83a4c4_2
keras-applications        1.0.7                      py_0
keras-preprocessing       1.0.9                      py_0
libiconv                  1.15              hfa6e2cd_1005    conda-forge
libpng                    1.6.37               h2a8f88b_0
libprotobuf               3.7.1                h7bd577a_0
libsodium                 1.0.16               h9d3ae62_0    anaconda
libtiff                   4.0.10               hb898794_2
libxml2                   2.9.9                h9ce36c8_0    conda-forge
libxslt                   1.1.32            heafd4d3_1002    conda-forge
llvmdev                   8.0.0                h1ad3211_1    conda-forge
markdown                  3.1                      py36_0
mkl                       2019.3                      203
mkl_fft                   1.0.12           py36h14836fe_0
mkl_random                1.0.2            py36h343c172_0
mock                      2.0.0            py36h9086845_0
numpy                     1.16.3           py36h19fb1c0_0
numpy-base                1.16.3           py36hc3f5095_0
opencv                    3.3.1            py36h20b85fd_1
openssl                   1.1.1b               hfa6e2cd_2    conda-forge
pbr                       5.1.3                      py_0
pip                       19.1.1                   py36_0
protobuf                  3.7.1            py36h33f27b4_0
pycodestyle               2.5.0                    pypi_0    pypi
pyreadline                2.1                      py36_1
pyside2                   5.9.0a1          py36h0555040_0    conda-forge
python                    3.6.8                h9f7ef89_7
pyzmq                     18.0.0           py36ha925a31_0    anaconda
qt                        5.9.7            vc14h73c81de_0
scipy                     1.2.1            py36h29ff71c_0
setuptools                41.0.1                   py36_0
six                       1.12.0                   py36_0
sqlite                    3.28.0               he774522_0
tensorboard               1.13.1           py36h33f27b4_0
tensorflow                1.13.1          gpu_py36h9006a92_0
tensorflow-base           1.13.1          gpu_py36h871c8ca_0
tensorflow-estimator      1.13.0                     py_0
tensorflow-gpu            1.13.1               h0d30ee6_0
termcolor                 1.1.0                    py36_1
vc                        14.1                 h21ff451_3    anaconda
vs2015_runtime            15.5.2                        3    anaconda
werkzeug                  0.15.2                     py_0
wheel                     0.33.4                   py36_0
wincertstore              0.2              py36h7fe50ca_0
xz                        5.2.4                h2fa13f4_4
zeromq                    4.3.1                h33f27b4_3    anaconda
zlib                      1.2.11               h62dcd97_3
zstd                      1.3.7                h508b16e_0

我针对失败的tensorflow 1.14.0版本的导入:

# Name                    Version                   Build  Channel
_tflow_select             2.1.0                       gpu
absl-py                   0.8.1                    py37_0
astor                     0.8.0                    py37_0
blas                      1.0                         mkl
ca-certificates           2019.11.27                    0    anaconda
certifi                   2019.11.28               py37_0    anaconda
cudatoolkit               10.0.130                      0
cudnn                     7.6.5                cuda10.0_0
cycler                    0.10.0                     py_2    conda-forge
freetype                  2.10.0               h563cfd7_1    conda-forge
gast                      0.3.2                      py_0
grpcio                    1.16.1           py37h351948d_1
h5py                      2.9.0            py37h5e291fa_0
hdf5                      1.10.4               h7ebc959_0
icc_rt                    2019.0.0             h0cc432a_1
icu                       64.2                 he025d50_1    conda-forge
imutils                   0.5.3                    py37_0    conda-forge
intel-openmp              2019.4                      245
jpeg                      9c                hfa6e2cd_1001    conda-forge
keras-applications        1.0.8                      py_0
keras-preprocessing       1.1.0                      py_1
kiwisolver                1.1.0            py37he980bc4_0    conda-forge
libblas                   3.8.0                    14_mkl    conda-forge
libcblas                  3.8.0                    14_mkl    conda-forge
libclang                  9.0.1           default_hf44288c_0    conda-forge
liblapack                 3.8.0                    14_mkl    conda-forge
liblapacke                3.8.0                    14_mkl    conda-forge
libopencv                 4.2.0                    py37_0    conda-forge
libpng                    1.6.37               h7602738_0    conda-forge
libprotobuf               3.11.2               h7bd577a_0
libsodium                 1.0.16               h9d3ae62_0    anaconda
libtiff                   4.1.0                h21b02b4_3    conda-forge
libwebp                   1.0.2                hfa6e2cd_5    conda-forge
lz4-c                     1.8.3             he025d50_1001    conda-forge
markdown                  3.1.1                    py37_0
matplotlib                3.1.2                    py37_1    conda-forge
matplotlib-base           3.1.2            py37h2981e6d_1    conda-forge
mkl                       2019.4                      245
mkl-service               2.3.0            py37hb782905_0
mkl_fft                   1.0.15           py37h14836fe_0
mkl_random                1.1.0            py37h675688f_0
numpy                     1.17.4           py37h4320e6b_0
numpy-base                1.17.4           py37hc3f5095_0
opencv                    4.2.0                    py37_0    conda-forge
openssl                   1.1.1                he774522_0    anaconda
pip                       19.3.1                   py37_0
protobuf                  3.11.2           py37h33f27b4_0
py-opencv                 4.2.0            py37h5ca1d4c_0    conda-forge
pyparsing                 2.4.6                      py_0    conda-forge
pyqt                      5.12.3           py37h6538335_1    conda-forge
pyqt5-sip                 4.19.18                  pypi_0    pypi
pyqtwebengine             5.12.1                   pypi_0    pypi
pyreadline                2.1                      py37_1
python                    3.7.5                h8c8aaf0_0
python-dateutil           2.8.1                      py_0    conda-forge
pyzmq                     18.1.0           py37ha925a31_0    anaconda
qt                        5.12.5               h7ef1ec2_0    conda-forge
scipy                     1.3.2            py37h29ff71c_0
setuptools                44.0.0                   py37_0
six                       1.13.0                   py37_0
sqlite                    3.30.1               he774522_0
tensorboard               1.14.0           py37he3c9ec2_0
tensorflow                1.14.0          gpu_py37h5512b17_0
tensorflow-base           1.14.0          gpu_py37h55fc52a_0
tensorflow-estimator      1.14.0                     py_0
tensorflow-gpu            1.14.0               h0d30ee6_0
termcolor                 1.1.0                    py37_1
tornado                   6.0.3            py37hfa6e2cd_0    conda-forge
vc                        14.1                 h0510ff6_4
vs2015_runtime            14.16.27012          hf0eaf9b_1
werkzeug                  0.16.0                     py_0
wheel                     0.33.6                   py37_0
wincertstore              0.2                      py37_0
wrapt                     1.11.2           py37he774522_0
xz                        5.2.4             h2fa13f4_1001    conda-forge
zeromq                    4.3.1                h33f27b4_3    anaconda
zlib                      1.2.11               h62dcd97_3
zstd                      1.4.4                hd8a0e53_1    conda-forge

0 个答案:

没有答案