python安装beautifulsoup失败_Win10环境下python36安装BeautifulSoup出现错误的解决办法

  • Post author:
  • Post category:python


说明:win10 64位系统,Python3.6.3

Win10环境下安装BeautifulSoup4貌似没有任何问题,但是当使用时就会报错,错误如下:

通过报错信息到相应的位置去查看文件

try:

is_file = os.path.exists(possible_filename)

except Exception, e:     #line175

# This is almost certainly a problem involving

# characters not valid in filenames on this

# system. Just let it go.

pass

经过查找分析,此处是下载的模块是用python版本2编写的,它与我在计算机上安装的python版本具有不兼容的语法(版本3)。

解决办法,到这个地址下载最新的库安装包:

https://www.crummy.com/software/BeautifulSoup/bs4/download/4.6/

下载解压后,进入到相应的目录,在命令行下运行python3 setup.py文件

个人下载到Python36的scripts之下了C:\XXX\ Local