Answer marked below. It was two problems. I was missing a semicolon in the env var path, and the latest Beautiful Soup is incompatible with my python script. Using an older version allowed it to run.
我正在尝试使用CMD窗口中的“Setup.py Install”在Windows中安装Beautiful Soup .
我得到以下错误...
Z:\Installers\beautifulsoup4-4.1.0>setup.py install
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
Z:\Installers\beautifulsoup4-4.1.0>
我见过this post和this post,但是,运行上面的命令会尝试安装,这让我相信python至少部分地在环境变量中正确设置 . cmd中的'python'命令本身是"not recognised",也不是"easy_install" . 让我觉得某些地方出了问题 . 我把它们都设置为...... C:\ Python27 \ C:\ Python27 \ Scripts
有谁知道使用easy_install或Setup.py导致我的Beautiful Soup安装失败的原因是什么?
编辑: C:\Path\To\Python27\python "C:\Path\To\BeautifulSoup\setup.py" install
工作 . 所以我不确定我的路径变量有什么问题 .
编辑2:虽然安装似乎工作,我仍然被告知美丽的汤没有安装 . Import Error: No module named BeautifulSoup
.
1 回答
如果在cmd中无法识别python命令本身,那么您应该修改系统环境变量以识别它 . 这是你如何做到的 . 转到 My Computer ‣ Properties ‣ Advanced ‣ Environment Variables 修改
path
变量并附加;C:\Python27\
. 确保路径用';'
分号分隔 . 设置完成后,确保使用echo %PATH%
将python附加到路径,同时在cmd中键入python
应该启动python shell要安装漂亮的汤,你需要运行
python setup.py install