mechanize codeを使用できません)。エラーにつながる部分はpython3.5でそれを実行する場合、私はまた「ImportError:Pythonで機械翻訳の名前をインポートできません」
を試してみました
#!/usr/bin/python
import re
from mechanize import
br = Browser()
ですが、私は次のエラーを見つける:
# python mechanize.py
Traceback (most recent call last):
File "mechanize.py", line 6, in <module>
from mechanize import Browser
File "/root/git/stakexchange-ask-question/mechanize.py", line 6, in <module>
from mechanize import Browser
ImportError: cannot import name Browser
これが示唆された正確に何があります公式にmechanize website
コードを変更する場合
#!/usr/bin/python
import re
br = mechanize.Browser()
また、私は
easy_install mechanize
'機械翻訳のインポートを必要としないコードを表示する' machineize.Browser()を実行するブラウザ 'が'機械化からブラウザをインポートする 'が削除された場合、 'AttributeError: 'module'オブジェクトに属性 'Browser''がありません – user123456
私の答えは速すぎました。あなたがPython <3.Xでないことを確認してください。 http://wwwsearch.sourceforge.net/mechanize/faq.html – pacode
あなたは正しいです。私のものはPython 2.7でした。どうもありがとうございます。 – user123456