2017-04-03 110 views
2

我仍然是超级新手!试图从在线教程学习,但我似乎被困在第一步!我想我安装了bs4,但它没有显示在python3中,是否安装在错误的地方?ModuleNotFoundError:没有名为'bs4'的模块

robbie$ sudo -H pip install bs4 
Requirement already satisfied: bs4 in /Library/Python/2.7/site-packages 
Requirement already satisfied: beautifulsoup4 in /Library/Python/2.7/site-packages (from bs4) 
Robbies-MBP:~ robbie$ python3 
Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import bs4 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ModuleNotFoundError: No module named 'bs4' 

任何帮助,将不胜感激:)

+0

运行于** python **不** ** python3 **因为你在'python2.7'中安装bs4 –

回答

6

Requirement already satisfied: bs4 in /Library/Python/2.7/site-packages

Python 3.6.1 (v3.6.1:69c0db5050, Mar 21 2017, 01:21:04)

您已安装的Python 2.7的模块,但是你使用,并试图import它与Python 3.6。

你必须使用pip3像你使用python3

+0

非常感谢!我尝试使用'pip3',现在它的作品非常漂亮! – robbie777

+0

不客气! – Vallentin

相关问题