[英]Python 64 bit not storing as long of string as 32 bit python
I have two computers, both running 64-bit Windows 7. One machine has python 32-bit, one is running python 64-bit. 我有两台计算机,都运行64位Windows7。一台计算机具有python 32位,一台正在运行python 64位。 Both machines have 8GB of RAM.
两台机器都有8GB的RAM。
I'm using BeautifulSoup to scrape a webpage, but I've been running into issues on my python64 machine. 我正在使用BeautifulSoup抓取网页,但是我一直在python64机器上遇到问题。 I've been able to figure out that the output of my
len(str(BeautifulSoup(request.get(http://www.sampleurl.com).text)))
in 64bit is only returning 92520 characters but on the same, static, site on my python32-bit machine, it's returning 135000 characters. 我已经弄清楚了我的
len(str(BeautifulSoup(request.get(http://www.sampleurl.com).text)))
在64位的输出仅返回92520个字符,但在相同的情况下,静态,在我的python32位计算机上,返回135000个字符。
At some point in the past on my python64-bit machine I had python32-bit, but uninstalled it to install python64-bit because I was having issues installing scipy using pip install (turns out that wasn't the issue). 在过去的某个时候,我在python64位计算机上安装了python32位,但是将其卸载以安装python64位,因为我在使用pip install安装scipy时遇到了问题(原来不是问题)。
Anyway, I'm unsure as to why my 64bit python machine isn't returning the entire html string and I was wondering if anyone can help me understand what is going on and how can I fix it. 无论如何,我不确定为什么我的64位python机器不返回整个html字符串,我想知道是否有人可以帮助我了解发生了什么以及如何修复它。
This is not a 32bit / 64bit issue. 这不是32位/ 64位问题。 You are most likely a parser issue;
您很可能是解析器问题; one machine using
lxml
vs. html.parser
on the other, for example. 例如,一台机器使用
lxml
vs. html.parser
。
Different parsers deal differently with broken HTML, and lxml
is the default only when installed. 不同的解析器对损坏的HTML的处理方式不同,并且
lxml
仅在安装时才是默认值。
See for example: 参见例如:
etc. 等等
Run import lxml
on both machines to verify. 在两台计算机上运行
import lxml
进行验证。 When you replaced your Python installation on one machine with a 64-bit version, you likely didn't include a compatible lxml
version. 当在一台计算机上用64位版本替换Python安装时,您可能未包含兼容的
lxml
版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.