我已经安装了Fuzzywuzzy模块,但是当我在jupyter笔记本中导入它时,出现错误,找不到模块

时间:2019-07-17 05:30:45

标签: python pip fuzzywuzzy

我已经安装了Fuzzywuzzy模块,当我在jupyter笔记本中导入它时,我可以在python shell中导入它,它给出未找到模块的错误。

List<Obligation>

2 个答案:

答案 0 :(得分:0)

经常发生此错误。我建议使用虚拟环境,然后进行pip install fuzzywuzzy 这是最理想,最确定的防火解决方案。以下是使用venv创建和激活虚拟环境的说明:

Mac OS和Linux:如何设置虚拟环境

1)克隆存储库后,将cd放入存储库并运行命令:python3 -m venv venv

    This will create the virtual environment. Make sure to name it venv because the .gitignore file
    has been initialized to ignore it by default. 

2)通过运行以下命令来激活虚拟环境:source venv/bin/activate

3)您随时可以运行deactivate离开虚拟环境。

Windows:如何设置虚拟环境

1)克隆存储库后,将cd放入存储库并运行命令:python -m venv venv

    This will create the virtual environment. Make sure to name it venv because the .gitignore file
    has been initialized to ignore it by default. 

2)通过运行以下命令来激活虚拟环境:venv\Scripts\activate.bat

    To activate the virtual environment inside of a code editor's bash, run: venv\Scripts\activate.ps1

3)您随时可以运行deactivate离开虚拟环境。

答案 1 :(得分:0)

比较Shell和Notebook中的sys.executable和sys.path。你是 运行相同的解释器,相同的站点包位置? – 阿玛丹19年7月17日在5:32

这就是我的答案!我已经从外壳复制了sys.path结果,以在笔记本中分配sys.path,如下所示:

sys.path = ['list-of-paths-from-my-shell']

然后,它解决了!

宾果

相关问题