我使用以下命令将机械化安装到目录中:sudo easy_install --always-unzip mechanizeSearching for mechanizeBest match: mechanize 0.2.5Processing mechanize-0.2.5-py2.7.eggmechanize 0.2.5 is already the active version in easy-install.pth, 但是,当我调用脚本scrape.py时遇到此错误:Traceback (most recent call last):File "scrape.py", line 6, in <module>from mechanize import BrowserImportError: No module named mechanize在升级到Mac OSX 10.8(从10.6版)并弄乱Java Ant之前,我曾使用过此脚本,如果有帮助的话。这是我的路:echo $PATH /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/ant/bin 你能告诉我如何解决这个问题吗?编辑:我解决了这个问题。将home的.bash_profile的第一行设置为# Setting PATH for MacPorts Python# The orginal version is saved in .bash_profile.pysavePATH="/opt/local/bin/python2.7:${PATH}"export PATH并在主目录的.bash_profile中删除了其他版本的Python。
1 回答
素胚勾勒不出你
TA贡献1827条经验 获得超9个赞
我修好了。将home的.bash_profile的第一行设置为
# Setting PATH for MacPorts Python
# The orginal version is saved in .bash_profile.pysave
PATH="/opt/local/bin/python2.7:${PATH}"
export PATH
并在主目录的.bash_profile中删除了其他版本的Python。
添加回答
举报
0/150
提交
取消