Windows下Python3安装BeautifulSoup4显示'You are trying to run the Python 2 version of Beautiful Soup under
2017-08-21 09:00
706 查看
今天安装BeautifulSoup4的时候一直出现这种错误,可是我的版本是Python3.6,我以为是我的Python版本高了,换成3.5还是出现这种问题,一开始搜到这篇博文,但是没有试试,造成浪费时间,以后不能太主观的否定了,多试试。
转载自:http://www.cnblogs.com/Dragon5/p/6498422.html
Windows下安装BeautifulSoup4显示’You are trying to run the Python 2 version of Beautiful Soup under Python 3.(
按照网上教程,将cmd的目录定位到解压缩文件夹地址,然后 >>python setup.py install
(
Window下不能直接解压tar.giz文件,可以使用7z解压软件提取解压再在CMD下打开
)
但是在IDLE中import bs4时,会出现:
在网上找了很久,始终没解决。
然后我又试了一下>>easy_setup.py,import bs4时报的错误却是:no such module.
解决办法:直接将压缩文件中的bs4复制到python安装目录下的lib中,然后再利用python自带工具2to3.py将版本2下的.py 文件转化为版本3下的文件。
具体:将bs4文件夹和2to3.py同时放到lib中,然后在cmd中定位到lib,运行:2to3.py bs4 -w就好了。
2to3.py位置:在python安装目录下的Tools/scripts/2to3.py。
2to3.py 用法:2to3.py param1 (-w)
param1 可以是要转换的.py文件,或者是文件夹,如果是文件夹,整个文件夹中的.py都会被转换。
-w可选,如果不写的话默认输出转换后的结果到显示屏,如果要把转换的文件再写入原文件,就需要加上。
现在,就可以from bs4 import BeautifulSoup了。
转载自:http://www.cnblogs.com/Dragon5/p/6498422.html
Windows下安装BeautifulSoup4显示’You are trying to run the Python 2 version of Beautiful Soup under Python 3.(
python setup.py install) or by running 2to3 (
2to3 -w bs4).’
按照网上教程,将cmd的目录定位到解压缩文件夹地址,然后 >>python setup.py install
(
Window下不能直接解压tar.giz文件,可以使用7z解压软件提取解压再在CMD下打开
)
但是在IDLE中import bs4时,会出现:
Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> import bs4 File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\bs4\__init__.py", line 48 'You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.'<>'You need to convert the code, either by installing it (`python setup.py install`) or by running 2to3 (`2to3 -w bs4`).'
在网上找了很久,始终没解决。
然后我又试了一下>>easy_setup.py,import bs4时报的错误却是:no such module.
解决办法:直接将压缩文件中的bs4复制到python安装目录下的lib中,然后再利用python自带工具2to3.py将版本2下的.py 文件转化为版本3下的文件。
具体:将bs4文件夹和2to3.py同时放到lib中,然后在cmd中定位到lib,运行:2to3.py bs4 -w就好了。
2to3.py位置:在python安装目录下的Tools/scripts/2to3.py。
2to3.py 用法:2to3.py param1 (-w)
param1 可以是要转换的.py文件,或者是文件夹,如果是文件夹,整个文件夹中的.py都会被转换。
-w可选,如果不写的话默认输出转换后的结果到显示屏,如果要把转换的文件再写入原文件,就需要加上。
现在,就可以from bs4 import BeautifulSoup了。
相关文章推荐
- Windows下使用BeautifulSoup 出现You are trying to run the Python 2 version of Beautiful Soup under Python
- Windows环境下安装beautifulsoup4出现 'You are trying to run the Python 2 version of Beautiful Soup ....错误
- 错误 You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work
- You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.
- 'You are trying to run the Python 2 version of Beautiful Soup under Python 3. This will not work.'<>
- Python 3.0安装BeautifulSoup插件并使用 与Python 2 version of Beautiful Soup under Python 3问题处理
- 【Datastage】Datastage在win10上安装报错:This Application requires one of the following versions of the .NET Framework:v1.1.4322 Do you want to install this .NET Framework version now?
- windows安装python出现A program run as part of the setup did not finish as expected 的解决办法
- docker 解决:Get http:///var/run/docker.sock/v1.19/version: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
- You are attempting to build with the incorrect version of java.
- The object of type 'RectTransform' has been destroyed but you are still trying to access it
- 安装mysql时,报“unable to find a version of the runtime to run this application ”
- You are attempting to build with the incorrect version of java.
- You are attempting to build with the incorrect version of java
- You are attempting to build with the incorrect version of java.
- Python——Windows安装Python出现A program run as part of the setup did not finish as expected的解决办法
- 安装mysql时,报“unable to find a version of the runtime to run this application ”
- Application windows are expected to have a root view controller at the end of application launch
- Application windows are expected to have a root view controller at the end of application launch解决方法
- ios6.0之后单个屏幕旋转,不用根视图以及Application windows are expected to have a root view controller at the end of