Python を始めてわずか 1 週間。easy_install を使用して BeautifulSoup4 をインストールしました。Pythonシェルでbs4 import BeautifulSoupから使用するとエラーが発生しないため、インストールは問題ないようです。
win7 の cmd コンソールから呼び出すスクリプトで「from bs4 import BeautifulSoup」を使用しようとすると、エラーが発生します「python C:\Users\Ryan\Desktop\降水.py」
from bs4 import BeautifulSoup
#precipitation.py:
import urllib.request
import re
from bs4 import BeautifulSoup
#htmlfile = urllib.request.urlopen("http://www.wunderground.com/history/airport/KYIP/2013/6/16/DailyHistory.html6")
#htmltext = htmlfile.read()
#regex = b'<td class="indent"><span>Precipitation</span></td>\n<td><span class="nobr"><span class="b">(.+?)</span>''
#pattern = re.compile(regex)
print('Who made the Soup?!')
スクリプト実行時のエラー: python C:\Users\Ryan\Desktop\降水量.py
Traceback (most recent call last):
File "C:\Users\Ryan\Desktop\precipitation.py", line 3, in
from bs4 import BeautifulSoup
File "C:\Users\Ryan\Desktop\precipitation.py", line 1, in <module>
from bs4 import BeautifulSoup
ImportError: cannot import name BeautifulSoup