Python 如何在 window 7 上安装 Beautiful Soup 模块?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13705279/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 09:25:16  来源:igfitidea点击:

How can I install the Beautiful Soup module on the window 7?

pythonbeautifulsoup

提问by ThanaDaray

I found the post at http://ricardianambivalence.com/2011/08/14/beautifulsoup-in-python-with-windows-7/

我在http://ricardianambivalence.com/2011/08/14/beautifulsoup-in-python-with-windows-7/找到了这篇文章

(I used python 2.6 and downloaded beautifulsoup4-4.1.3)

(我用的是python 2.6,下载的是beautifulsoup4-4.1.3)

I could not find "BeautifulSoup.pyc" after run "setup.py"

运行“setup.py”后找不到“BeautifulSoup.pyc”

Any suggest?

有什么建议吗?

采纳答案by 0605002

I know it's in no way a good method, but what I always do is copying the folderbs4at path C:\Python27\Lib\site-packages. Always works :)

我知道这绝不是一个好方法,但我总是bs4在 path复制文件夹C:\Python27\Lib\site-packages。总是有效:)

回答by jfs

To check whether your installation is successful, type in a Python shell (or any of your Python script):

要检查您的安装是否成功,请输入 Python shell(或任何 Python 脚本):

from bs4 import BeautifulSoup

To install a pure python package such as beautifulsoup4, run:

要安装纯 python 包,例如beautifulsoup4,请运行:

C:\> pip install beautifulsoup4

To install pip, download get-pip.pyand run:

要安装pip、下载get-pip.py并运行:

C:\> python get-pip.py

回答by Anshu Kumar Gupta

Open cmd.

打开cmd。

Go to the directory where you decompressed the package, then write this:

进入解压包所在的目录,然后这样写:

c:\python33\python.exe setup.py install

Change python33 to the directory where python is installed.

将 python33 更改为安装 python 的目录。