Найти - Пользователи
Полная версия: Не ставится from bs4 import BeautifulSoup
Начало » Python для новичков » Не ставится from bs4 import BeautifulSoup
1
satfan
IDLE (Python 3.8 32-bit) Windows 7
index.html — лежит в папке со скриптом.
————-
Запускаю этот скрипт:
 from bs4 import BeautifulSoup
import re
def main():
    html = open('index.html').read()
    print(html)
    
  if __name__ == '__main__':
    main()
Получаю ошибку:
[code python]Traceback (most recent call last):
File "C:\Users\Александр\Desktop\6\main.py", line 2, in <module>
from bs4 import BeautifulSoup
File "C:\Python38-32\lib\site-packages\bs4\__init__.py", line 32, in <module>
from .builder import builder_registry, ParserRejectedMarkup
File "C:\Python38-32\lib\site-packages\bs4\builder\__init__.py", line 515, in <module>
from . import _lxml
File "C:\Python38-32\lib\site-packages\bs4\builder\_lxml.py", line 16, in <module>
from lxml import etree
File "src\lxml\etree.pyx", line 1, in init lxml.etree
ValueError: builtins.type size changed, may indicate binary incompatibility. Expected 440 from C header, got 432 from PyObject[/code]
Раньше все модули ставились так:
C:\Python38-32\python.exe -m pip install beautifulsoup
Пробовал так:
C:\Python38-32\python.exe -m pip install –upgrade beautifulsoup4
Обновилось. Что мне сделать ?
xam1816
попробуйте удалить через pip uninstall, потом обратно установить,
satfan
Уважаемый xam1816 спасибо.
Всё сделал как Вы сказали.
Опять ошибка:
 Traceback (most recent call last):
  File "C:\Users\Александр\Desktop\6\main.py", line 2, in <module>
    from bs4 import BeautifulSoup
  File "C:\Python38-32\lib\site-packages\bs4\__init__.py", line 32, in <module>
    from .builder import builder_registry, ParserRejectedMarkup
  File "C:\Python38-32\lib\site-packages\bs4\builder\__init__.py", line 515, in <module>
    from . import _lxml
  File "C:\Python38-32\lib\site-packages\bs4\builder\_lxml.py", line 16, in <module>
    from lxml import etree
  File "src\lxml\etree.pyx", line 1, in init lxml.etree
ValueError: builtins.type size changed, may indicate binary incompatibility. Expected 440 from C header, got 432 from PyObject
xam1816
satfan
Опять ошибка:
Выложите полный код
satfan
 Python 3.8.0a1 (tags/v3.8.0a1:e75eeb00b5, Feb  3 2019, 19:46:54) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
=============== RESTART: C:\Users\Александр\Desktop\6\main.py ===============
Traceback (most recent call last):
  File "C:\Users\Александр\Desktop\6\main.py", line 2, in <module>
    from bs4 import BeautifulSoup
  File "C:\Python38-32\lib\site-packages\bs4\__init__.py", line 32, in <module>
    from .builder import builder_registry, ParserRejectedMarkup
  File "C:\Python38-32\lib\site-packages\bs4\builder\__init__.py", line 515, in <module>
    from . import _lxml
  File "C:\Python38-32\lib\site-packages\bs4\builder\_lxml.py", line 16, in <module>
    from lxml import etree
  File "src\lxml\etree.pyx", line 1, in init lxml.etree
ValueError: builtins.type size changed, may indicate binary incompatibility. Expected 440 from C header, got 432 from PyObject
>>> 
xam1816
может вам еще вот это скачать

 pip install lxml
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB