使用Windows上的conda将Python模块安装到本地环境后,Python模块无法正常工作

时间:2018-03-29 13:35:52

标签: python conda

让我先说一下我对python有点新鲜。

我导入后似乎无法访问包。 这是一个例子:

 C:\Users\Tyler
(base) λ conda install beautifulsoup4
Solving environment: done

# All requested packages already installed.


    C:\Users\Tyler
    (base) λ python
    Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import beautifulsoup4
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'beautifulsoup4'

我似乎无法弄清楚这一点。我已经阅读了一些关于更改.bashrc文件的内容,但我似乎无法找到它。

此外我的PYTHONPATH没有任何设置,所以这不是问题。

下面是我的conda信息

conda info



    active environment : base
    active env location : C:\ProgramData\Anaconda3
            shell level : 1
       user config file : C:\Users\Tyler\.condarc
 populated config files : C:\Users\Tyler\.condarc
          conda version : 4.5.0
    conda-build version : 3.0.27
         python version : 3.6.4.final.0
       base environment : C:\ProgramData\Anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/win-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/win-64
                          https://repo.anaconda.com/pkgs/pro/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\ProgramData\Anaconda3\pkgs
                          C:\Users\Tyler\AppData\Local\conda\conda\pkgs
       envs directories : C:\ProgramData\Anaconda3\envs
                          C:\Users\Tyler\AppData\Local\conda\conda\envs
                          C:\Users\Tyler\.conda\envs
               platform : win-64
             user-agent : conda/4.5.0 requests/2.18.4 CPython/3.6.4 Windows/10 Windows/10.0.16299
          administrator : True
             netrc file : None
           offline mode : False

非常感谢任何帮助,谢谢!

P.S:导入from bs4 import beautifulsoup会引发ModuleNotFoundError: No module named bs4

1 个答案:

答案 0 :(得分:0)

我的机器上安装了多个版本的python。谢谢大家的帮助!