2017-04-03 131 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

相關問題