如何在windows上使用python 2.7安装漂亮的soup 4 ?

时间:2022-11-29 13:11:38

I have windows vista with Python 2.7. I would like to install BeautifulSoup 4 but apparently I can't install Beautiful Soup just by copying the file into the site-packages directory. I have to install pip and then run some commands from the command prompt. Could you guide me through that step by step. I am really a noob so make it very simple. Thanks in advance

我有windows vista和Python 2.7。我想要安装漂亮的汤,但是很明显,我不能仅仅通过把文件复制到站点包目录来安装漂亮的汤。我必须安装pip,然后从命令提示符运行一些命令。你能一步一步地指导我吗?我真的是一个菜鸟,所以让它很简单。谢谢提前

4 个解决方案

#1


38  

You don't need pip for installing Beautiful Soup - you can just download it and run python setup.py install from the directory that you have unzipped BeautifulSoup in (assuming that you have added Python to your system PATH - if you haven't and you don't want to you can run C:\Path\To\Python27\python "C:\Path\To\BeautifulSoup\setup.py" install)

您不需要pip来安装漂亮的Soup——您只需下载它并运行python设置即可。如果你已经在系统路径上添加了Python(假设你已经在系统路径中添加了Python), py安装在你的目录中,如果你没有,并且你不想要,你可以运行C:\ PATH \到\Python27\ Python“C:\路径\ \漂亮的汤\设置”。py安装)

However, you really should install pip - see How to install pip on Windows for how to do that best (via @MartijnPieters comment)

但是,您确实应该安装pip—看看如何在Windows上安装pip,以便如何做到最好(通过@MartijnPieters评论)

#2


22  

easy_install BeautifulSoup4

or

easy_install BeautifulSoup 

to install easy_install

安装easy_install

http://pypi.python.org/pypi/setuptools#files

#3


19  

Install pip

pip安装

Download get-pip. Remember to save it as "get-pip.py"

下载get-pip。记得把它保存为“get-pi .py”

Now go to the download folder. Right click on get-pip.py then open with python.exe.

现在转到下载文件夹。右键单击get-pip。然后用python打开。

You can add system variable by

你可以添加系统变量。

(by doing this you can use pip and easy_install without specifying path)

(通过这样做,您可以使用pip和easy_install而无需指定路径)

1 Clicking on Properties of My Computer

点击我电脑的属性。

2 Then chose Advanced System Settings

然后选择高级系统设置。

3 Click on Advanced Tab

点击高级选项卡。

4 Click on Environment Variables

4点击环境变量。

5 From System Variables >>> select variable path.

从系统变量>>>选择变量路径。

6 Click edit then add the following lines at the end of it

点击编辑,然后在它的末尾添加以下几行。

 ;c:\Python27;c:\Python27\Scripts

(please dont copy this, just go to your python directory and copy the paths similar to this)

(请不要复制这个,只要转到python目录并复制类似的路径)

NB:- you have to do this once only.

NB:-你必须只做一次。

Install beautifulsoup4

安装beautifulsoup4

Open cmd and type

打开cmd和类型

pip install beautifulsoup4

#4


5  

I feel most people have pip installed already with Python. On Windows, one way to check for pip is to open Command Prompt and typing in:

我觉得大多数人都已经安装了Python。在Windows上,检查pip的一种方法是打开命令提示符并输入:

python -m pip

If you get Usage and Commands instructions then you have it installed. If python was not found though, then it needs to be added to the path. Alternatively you can run the same command from within the installation directory of python.

如果您获得了使用和命令指示,那么您就已经安装了它。如果没有找到python,则需要将其添加到路径中。或者,您也可以在python的安装目录中运行相同的命令。

If all is good, then this command will install BeautifulSoup easily:

如果一切都很好,那么这个命令很容易安装漂亮的汤:

python -m pip install BeautifulSoup4

Screenshot:

截图:

如何在windows上使用python 2.7安装漂亮的soup 4 ?

N' now I see I need to upgrade my pip, which I just did :)

现在我看到我需要升级我的pip了,我就是这样做的:

#1


38  

You don't need pip for installing Beautiful Soup - you can just download it and run python setup.py install from the directory that you have unzipped BeautifulSoup in (assuming that you have added Python to your system PATH - if you haven't and you don't want to you can run C:\Path\To\Python27\python "C:\Path\To\BeautifulSoup\setup.py" install)

您不需要pip来安装漂亮的Soup——您只需下载它并运行python设置即可。如果你已经在系统路径上添加了Python(假设你已经在系统路径中添加了Python), py安装在你的目录中,如果你没有,并且你不想要,你可以运行C:\ PATH \到\Python27\ Python“C:\路径\ \漂亮的汤\设置”。py安装)

However, you really should install pip - see How to install pip on Windows for how to do that best (via @MartijnPieters comment)

但是,您确实应该安装pip—看看如何在Windows上安装pip,以便如何做到最好(通过@MartijnPieters评论)

#2


22  

easy_install BeautifulSoup4

or

easy_install BeautifulSoup 

to install easy_install

安装easy_install

http://pypi.python.org/pypi/setuptools#files

#3


19  

Install pip

pip安装

Download get-pip. Remember to save it as "get-pip.py"

下载get-pip。记得把它保存为“get-pi .py”

Now go to the download folder. Right click on get-pip.py then open with python.exe.

现在转到下载文件夹。右键单击get-pip。然后用python打开。

You can add system variable by

你可以添加系统变量。

(by doing this you can use pip and easy_install without specifying path)

(通过这样做,您可以使用pip和easy_install而无需指定路径)

1 Clicking on Properties of My Computer

点击我电脑的属性。

2 Then chose Advanced System Settings

然后选择高级系统设置。

3 Click on Advanced Tab

点击高级选项卡。

4 Click on Environment Variables

4点击环境变量。

5 From System Variables >>> select variable path.

从系统变量>>>选择变量路径。

6 Click edit then add the following lines at the end of it

点击编辑,然后在它的末尾添加以下几行。

 ;c:\Python27;c:\Python27\Scripts

(please dont copy this, just go to your python directory and copy the paths similar to this)

(请不要复制这个,只要转到python目录并复制类似的路径)

NB:- you have to do this once only.

NB:-你必须只做一次。

Install beautifulsoup4

安装beautifulsoup4

Open cmd and type

打开cmd和类型

pip install beautifulsoup4

#4


5  

I feel most people have pip installed already with Python. On Windows, one way to check for pip is to open Command Prompt and typing in:

我觉得大多数人都已经安装了Python。在Windows上,检查pip的一种方法是打开命令提示符并输入:

python -m pip

If you get Usage and Commands instructions then you have it installed. If python was not found though, then it needs to be added to the path. Alternatively you can run the same command from within the installation directory of python.

如果您获得了使用和命令指示,那么您就已经安装了它。如果没有找到python,则需要将其添加到路径中。或者,您也可以在python的安装目录中运行相同的命令。

If all is good, then this command will install BeautifulSoup easily:

如果一切都很好,那么这个命令很容易安装漂亮的汤:

python -m pip install BeautifulSoup4

Screenshot:

截图:

如何在windows上使用python 2.7安装漂亮的soup 4 ?

N' now I see I need to upgrade my pip, which I just did :)

现在我看到我需要升级我的pip了,我就是这样做的: