代码之家  ›  专栏  ›  技术社区  ›  GCGM

Jupyter模块安装失败,但不在终端

  •  0
  • GCGM  · 技术社区  · 3 年前

    我正在Windows计算机中使用以下命令创建conda-env:

    conda create -n s1 python=3.6
    conda activate s1
    conda config --env --add channels conda-forge
    conda config --env --set channel_priority strict
    

    然后,我安装 geopandas, rasterio, jupyterlab 包装:

    conda install geopandas
    conda install jupyterlab
    conda install raserio
    

    如果我从终端打开python并加载包:

    (s1) C:\>python
    Python 3.6.13 (default, Sep  7 2021, 06:39:02) [MSC v.1916 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import geopandas
    >>> import rasterio
    

    一切正常。但是,如果我打开 jupyter lab :

    (s1) C:\>jupyter lab
    

    并尝试在代码单元中加载相同的包,我得到以下错误:

    import rasterio
    
    
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-1-350e27267e59> in <module>
    ----> 1 import rasterio
    
    ~\Anaconda3\envs\s1\lib\site-packages\rasterio\__init__.py in <module>
         20             pass
         21 
    ---> 22 from rasterio._base import gdal_version
         23 from rasterio.drivers import is_blacklisted
         24 from rasterio.dtypes import (
    
    ImportError: DLL load failed: The specified procedure could not be found.
    

    如果我尝试 geopandas :

    import geopandas
    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    <ipython-input-2-fc7d1d298f0c> in <module>
    ----> 1 import geopandas
    
    ~\Anaconda3\envs\s1\lib\site-packages\geopandas\__init__.py in <module>
          5 from geopandas.array import points_from_xy  # noqa
          6 
    ----> 7 from geopandas.io.file import _read_file as read_file  # noqa
          8 from geopandas.io.arrow import _read_parquet as read_parquet  # noqa
          9 from geopandas.io.arrow import _read_feather as read_feather  # noqa
    
    ~\Anaconda3\envs\s1\lib\site-packages\geopandas\io\file.py in <module>
         18 
         19 try:
    ---> 20     from fiona import Env as fiona_env
         21 except ImportError:
         22     try:
    
    ~\Anaconda3\envs\s1\lib\site-packages\fiona\__init__.py in <module>
         83 
         84 import fiona._loading
    ---> 85 with fiona._loading.add_gdal_dll_directories():
         86     from fiona.collection import BytesCollection, Collection
         87     from fiona.drvsupport import supported_drivers
    
    AttributeError: module 'fiona' has no attribute '_loading'
    

    原因是什么?

    ---编辑---

    从这个问题中,我认为解决方案是删除 rasterio 从我的conda-env中安装 pip .我可以接受,但我更愿意继续安装

    How to Fix: "ImportError: DLL load failed The specified procedure could not be found." when the DLLs are there

    0 回复  |  直到 3 年前