【发布时间】:2012-12-18 04:24:53
【问题描述】:
我已经在我的 windows7 PC 上安装了 python 2.7。现在我通过了Beautiful Soup。现在我找到了两个安装 BeautifulSoup4 的命令。 easy_install beautifulsoup4 和 pip install beautifulsoup4。但我的困惑是我必须在哪个目录中运行这些命令。我的 python 文件夹是 C:\Python27。你能帮我在哪里运行那个命令吗?
错误
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Arup Rakshit>cd..
C:\Users>cd..
C:\>cd C:\Python27
C:\Python27>python.exe virtualenv.py selenv
New python executable in selenv\Scripts\python.exe
Installing setuptools....................................done.
Installing pip.........................done.
C:\Python27>cd selenv\Scripts\
C:\Python27\selenv\Scripts>pip.exe install selenium
Downloading/unpacking selenium
Downloading selenium-2.28.0.tar.gz (2.1MB): 2.1MB downloaded
Running setup.py egg_info for package selenium
C:\Python27\Lib\distutils\dist.py:267: UserWarning: Unknown distribution opt
ion: 'src_root'
warnings.warn(msg)
warning: no files found matching 'docs\api\py\index.rst'
Installing collected packages: selenium
Running setup.py install for selenium
C:\Python27\Lib\distutils\dist.py:267: UserWarning: Unknown distribution opt
ion: 'src_root'
warnings.warn(msg)
warning: no files found matching 'docs\api\py\index.rst'
Successfully installed selenium
Cleaning up...
C:\Python27\selenv\Scripts>python.exe my_selenium_script.py
python.exe: can't open file 'my_selenium_script.py': [Errno 2] No such file or d
irectory
C:\Python27\selenv\Scripts>python.exe my_selenium_script.py
Hello
C:\Python27\selenv\Scripts>cd..
C:\Python27\selenv>pip install beautifulsoup4
'pip' is not recognized as an internal or external command,
operable program or batch file.
C:\Python27\selenv>
谢谢
【问题讨论】:
-
您可以从任何目录运行这些命令中的任何一个。 BS 包将安装到
C:\Python27\Lib\site-packages。更多详情请参考:docs.python.org/2/install/index.html#how-installation-works -
@bernie 请查看描述,我收到错误消息。在这里指导我!
-
@PaulC 这个链接太令人困惑了......有很多建议......我很困惑。我也安装了 python 2.7 和 selenium。现在如何在我的情况下获得
beautiful soup指导我!!希望对我更好