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

    

 

posted @ 2016-09-14 00:56 syoukaihou 阅读(...) 评论(...) 编辑 收藏