python--windows下安装BeautifulSoup

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python--windows下安装BeautifulSoup相关的知识,希望对你有一定的参考价值。

python有很多内置的模块可以不安装使用,用起来非常方便,但是也有一些挺有用的非内置的模块不能直接使用,需要话费点力气手动安装。

进入python安装目录下的Scripts目录,查看是否有pip工具为了避免出现一些未知错误,DOS窗口使用管理员权限打开。

    技术分享

使用pip工具安装,在python安装目录下的Scripts目录下执行如下命令。

pip install beautifulsoup4

    技术分享

可能会出现以下错误:

错误信息

Collecting pip
Using cached pip-8.1.2-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 7.1.2
Uninstalling pip-7.1.2:
Exception:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python27\python2.7.11\lib\site-packages\pip\basecommand.py", line 211
, in main
status = self.run(options, args)
File "C:\Program Files (x86)\Python27\python2.7.11\lib\site-packages\pip\commands\install.py", lin
e 311, in run
root=options.root_path,
File "C:\Program Files (x86)\Python27\python2.7.11\lib\site-packages\pip\req\req_set.py", line 640
, in install
requirement.uninstall(auto_confirm=True)
File "C:\Program Files (x86)\Python27\python2.7.11\lib\site-packages\pip\req\req_install.py", line
716, in uninstall
paths_to_remove.remove(auto_confirm)
File "C:\Program Files (x86)\Python27\python2.7.11\lib\site-packages\pip\req\req_uninstall.py", li
ne 125, in remove
renames(path, new_path)
File "C:\Program Files (x86)\Python27\python2.7.11\lib\site-packages\pip\utils\__init__.py", line
315, in renames
shutil.move(old, new)
File "C:\Program Files (x86)\Python27\python2.7.11\lib\shutil.py", line 303, in move
os.unlink(src)
WindowsError: [Error 5] : ‘c:\\program files (x86)\\python27\\python2.7.11\\lib\\site-packages\\pip-
7.1.2.dist-info\\description.rst‘
You are using pip version 7.1.2, however version 8.1.2 is available.
You should consider upgrading via the ‘python -m pip install --upgrade pip‘ command.

解决方法:升级pip工具(注意:此条命令要在拥有管理员权限的DOS窗口下执行

python -m pip install -U pip

    技术分享

 

以上是关于python--windows下安装BeautifulSoup的主要内容,如果未能解决你的问题,请参考以下文章

Python:windows环境下 安装python3

[Python]Windows系统下安装Pillow模块

windows下面安装Python和pip教程

windows下安装python的numpy,scipy,sklearn

python---windows下安装和使用memcache

Python--Windows下安装虚拟环境