Anaconda导入错误,刚安装的模块未找到

时间:2018-02-14 19:30:50

标签: python anaconda

又一个导入错误问题,我知道...... 关于这个问题我在stackoverflow上经历了很多帖子,但似乎没什么帮助

这是事情,我不是一个Windows用户,我已经在Mac和Linux上使用了anaconda很长一段时间,但现在我必须用Windows10训练Python上的人。 所以我试着安装Anaconda,好好想想那应该很容易......

我做了什么:

  1. 安装miniconda3
  2. 创建一个名为' first'的conda环境。 - 激活它
  3. 安装numpy scipy和geopandas(conda install -c conda-forge geopandas
  4. 启动IPython
  5. 键入import geopandas并获得导入错误ModuleNotFoundError: No module named 'geopandas'
  6. 请注意,Geopandas和所有软件包都显示在我的环境的pip列表中

    然后我用这个结果导入sys和typed sys.path(sys.executable很好)

    ['',
     'C:\\Users\\mine\\Miniconda3\\Scripts',
     'C:\\Users\\mine\\Miniconda3\\python36.zip',
     'C:\\Users\\mine\\Miniconda3\\DLLs',
     'C:\\Users\\mine\\Miniconda3\\lib',
     'C:\\Users\\mine\\Miniconda3',
     'C:\\Users\\mine\\Miniconda3\\lib\\site-packages',
     'C:\\Users\\mine\\Miniconda3\\lib\\site-packages\\win32',
     'C:\\Users\\mine\\Miniconda3\\lib\\site-packages\\win32\\lib',
     'C:\\Users\\mine\\Miniconda3\\lib\\site-packages\\Pythonwin',
     'C:\\Users\\mine\\Miniconda3\\lib\\site-packages\\IPython\\extensions',
     'C:\\Users\\mine\\.ipython']
    

    我相信我应该在那里看到有关我的conda环境的事情

    c:\users\mine\miniconda3\envs\first\ 
    

    我做错了什么?我该如何修复它?为什么你认为发生了这种情况?我应该向anaconda报告,因为这似乎是一件很烦人的事情。 如果有帮助:

    (first) C:\Users\mine>conda info -a
    
         active environment : first
        active env location : C:\Users\mine\Miniconda3\envs\first
                shell level : 2
           user config file : C:\Users\mine\.condarc
     populated config files :
              conda version : 4.4.10
        conda-build version : not installed
             python version : 3.6.3.final.0
           base environment : C:\Users\mine\Miniconda3  (writable)
               channel URLs : https://repo.continuum.io/pkgs/main/win-64
                              https://repo.continuum.io/pkgs/main/noarch
                              https://repo.continuum.io/pkgs/free/win-64
                              https://repo.continuum.io/pkgs/free/noarch
                              https://repo.continuum.io/pkgs/r/win-64
                              https://repo.continuum.io/pkgs/r/noarch
                              https://repo.continuum.io/pkgs/pro/win-64
                              https://repo.continuum.io/pkgs/pro/noarch
                              https://repo.continuum.io/pkgs/msys2/win-64
                              https://repo.continuum.io/pkgs/msys2/noarch
              package cache : C:\Users\mine\Miniconda3\pkgs
                              C:\Users\mine\AppData\Local\conda\conda\pkgs
           envs directories : C:\Users\mine\Miniconda3\envs
                              C:\Users\mine\AppData\Local\conda\conda\envs
                              C:\Users\mine\.conda\envs
                   platform : win-64
                 user-agent : conda/4.4.10 requests/2.18.4 CPython/3.6.3 Windows/10 Windows/10.0.16299
              administrator : False
                 netrc file : None
               offline mode : False
    
    # conda environments:
    #
    base                     C:\Users\mine\Miniconda3
    first                 *  C:\Users\mine\Miniconda3\envs\first
    
    sys.version: 3.6.3 |Anaconda, Inc.| (default, Nov  8 ...
    sys.prefix: C:\Users\mine\Miniconda3
    sys.executable: C:\Users\mine\Miniconda3\python.exe
    conda location: C:\Users\mine\Miniconda3\lib\site-packages\conda
    conda-build: None
    conda-env: C:\Users\mine\Miniconda3\Scripts\conda-env.exe
    user site dirs:
    
    CIO_TEST: <not set>
    CONDA_DEFAULT_ENV: first
    CONDA_PREFIX: C:\Users\mine\Miniconda3\envs\first
    CONDA_PREFIX_1: C:\Users\mine\Miniconda3
    CONDA_PROMPT_MODIFIER: (first)
    CONDA_PYTHON_EXE: C:\Users\mine\Miniconda3\python.exe
    CONDA_ROOT: C:\Users\mine\Miniconda3
    CONDA_SHLVL: 2
    HOMEPATH: \Users\mine
    PATH: C:\Users\mine\Miniconda3\envs\first;C:\Users\mine\Miniconda3\envs\first\Library\mingw-w64\bin;C:\Users\mine\Miniconda3\envs\first\Library\usr\bin;C:\Users\mine\Miniconda3\envs\first\Library\bin;C:\Users\mine\Miniconda3\envs\first\Scripts;C:\Users\mine\Miniconda3\envs\first\bin;C:\Users\mine\Miniconda3;C:\Users\mine\Miniconda3\Library\mingw-w64\bin;C:\Users\mine\Miniconda3\Library\usr\bin;C:\Users\mine\Miniconda3\Library\bin;C:\Users\mine\Miniconda3\Scripts;C:\Users\mine\Miniconda3\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Users\mine\AppData\Local\Microsoft\WindowsApps;
    PSMODULEPATH: C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
    PYTHONIOENCODING: 1252
    REQUESTS_CA_BUNDLE: <not set>
    SSL_CERT_FILE: <not set>
    

1 个答案:

答案 0 :(得分:2)

您还需要将IPython安装到新环境中:

conda install ipython

否则它使用ipython形式&#34;外部&#34;环境,因为它是一个命令行应用程序,不需要连接到环境。

您可以查看您使用的IPython:

 where ipython