安装使用PIP美丽的汤 [英] install beautiful soup using pip

查看:371
本文介绍了安装使用PIP美丽的汤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用 PIP 在Python 2.7安装BeautifulSoup。我不断收到错误信息,并不能明白为什么。

I am trying to install BeautifulSoup using pip in Python 2.7. I keep getting an error message, and can't understand why.

我按照说明安装点子,这是安装到以下目录: C:\\ Python27 \\脚本\\ pip.exe ,然后我试着将它添加到路径和运行 PIP安装包命令。

I followed the instructions to install pip, which was installed to the following directory: c:\Python27\Scripts\pip.exe, then I tried adding it to the path, and running the pip install package command.

尝试了两种不同的方式:

tried it two different ways:

import sys
sys.path.append('C:\\Python27\\Scripts\\pip.exe')
pip install beautifulsoup4

import sys
sys.path.append('C:\\Python27\\Scripts')
pip install beautifulsoup4

这两个给我这个错误消息:

both give me this error message:

>>> pip install beautifulsoup4
SyntaxError: invalid syntax

外壳是突出的单词安装,并说这是无效的语法。

the shell is highlighting the word "install" and saying that it's invalid syntax.

我不知道发生了什么事情,所以任何帮助将大大AP preciated。

I have no idea what's going on, so any help would be greatly appreciated.

推荐答案

PIP 命令行工具的,而不是Python语法。

pip is a command line tool, not Python syntax.

在换句话说,在控制台运行的命令,的不是在Python间preTER 的:

In other words, run the command in your console, not in the Python interpreter:

pip install beautifulsoup4

您可能需要使用的完整路径:

You may have to use the full path:

C:\Python27\Scripts\pip install beautifulsoup4

甚至

C:\Python27\Scripts\pip.exe install beautifulsoup4

视窗将执行 PIP 程序和的将使用Python来安装软件包。

Windows will then execute the pip program and that will use Python to install the package.

这篇关于安装使用PIP美丽的汤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆