【发布时间】:2017-03-13 05:04:10
【问题描述】:
我的 Mac OSX 10.7.4 上同时安装了 python 2.7 和 3.5。 我用 3.5 编写的 python 脚本使用以下命令可以正常工作:
python3 <file.py>
但是,运行另一个与 python 2.7 兼容的脚本会给我这个错误:
python testfile.py
Traceback (most recent call last):
File "testfile.py", line 29, in <module>
br.select_form(name="signinWidget")
File "build/bdist.macosx-10.7-intel/egg/mechanize/_mechanize.py", line 524, in select_form
mechanize._mechanize.FormNotFoundError: no form matching name 'signinWidget'
脚本使用 mechanize 和 BeautifulSoup 包。
>which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
我试过了:
python -m pip install BeautifulSoup,mechanize
但它不能解决这个问题。
如何确保脚本指向已安装在我的 mac 上的正确软件包?
【问题讨论】:
标签: macos python-2.7 python-3.5