GVKun编程网logo

ImportError:没有名为 bs4 的模块(BeautifulSoup)

11

想了解ImportError:没有名为bs4的模块的新动态吗?本文将为您提供详细的信息,我们还将为您解答关于BeautifulSoup的相关问题,此外,我们还将为您介绍关于BeautifulSoup已

想了解ImportError:没有名为 bs4 的模块的新动态吗?本文将为您提供详细的信息,我们还将为您解答关于BeautifulSoup的相关问题,此外,我们还将为您介绍关于BeautifulSoup 已安装但仍出现 ImportError: No module named BeautifulSoup、django – ImportError:没有名为south的模块、from bs4 import BeautifulSoup 报错、import OAuth2Authentication ImportError:没有名为“ oauth2_provider.ext”的模块的新知识。

本文目录一览:

ImportError:没有名为 bs4 的模块(BeautifulSoup)

ImportError:没有名为 bs4 的模块(BeautifulSoup)

我正在使用 Python 并使用 Flask。当我在我的计算机上运行我的主要 Python 文件时,它运行良好,但是当我激活 venv 并在终端中运行
Flask Python 文件时,它说我的主要 Python 文件有“没有名为 bs4 的模块”。非常感谢任何意见或建议。

答案1

小编典典

激活 virtualenv,然后安装 BeautifulSoup4:

$ pip install BeautifulSoup4

当您使用 安装bs4easy_install,您在系统范围内安装了它。所以你的系统 python 可以导入它,但不是你的 virtualenv
python。如果你不需要bs4安装在你的系统python路径下,卸载它并保留在你的virtualenv中。

有关 virtualenvs 的更多信息,请阅读此

BeautifulSoup 已安装但仍出现 ImportError: No module named BeautifulSoup

BeautifulSoup 已安装但仍出现 ImportError: No module named BeautifulSoup

如何解决BeautifulSoup 已安装但仍出现 ImportError: No module named BeautifulSoup?

我成功安装了 BeautifulSoup。这是最新的更新。但我仍然得到“

df[''Most_OCCURING''] = df.groupby(''Date'')[''Type''].transform(lambda x: x.value_counts().idxmax())

运行代码时。 需要帮助!!

解决方法

试试:

from bs4 import BeautifulSoup

django – ImportError:没有名为south的模块

django – ImportError:没有名为south的模块

运行syncdb时遇到错误`ImportError:没有名为south的模块.有什么建议? Django 1.5.1和 Python 2.7.5

我认为South已经安装,因为我刚刚运行easy_install并且得到了

[ckoziak@web415 mvp_landing]$easy_install south
Searching for south
Best match: South 0.8.1
Processing South-0.8.1-py2.4.egg
South 0.8.1 is already the active version in easy-install.pth

Using /home/ckoziak/lib/python2.4/South-0.8.1-py2.4.egg
Processing dependencies for south
Finished processing dependencies for south

但在此之前我运行pip install south并获得:

[ckoziak@web415 mvp_landing]$ls
join  manage.py  mvp_landing  static
[ckoziak@web415 mvp_landing]$pip install south
Traceback (most recent call last):
File "/home/ckoziak/bin/pip",line 7,in ?
sys.exit(
File "/usr/local/lib/python2.4/site-packages/pkg_resources.py",line 277,in       load_entry_point
return get_distribution(dist).load_entry_point(group,name)
File "/usr/local/lib/python2.4/site-packages/pkg_resources.py",line 2180,in load_entry_point
return ep.load()
File "/usr/local/lib/python2.4/site-packages/pkg_resources.py",line 1913,in load
entry = __import__(self.module_name,globals(),[''__name__''])
File "/home/ckoziak/lib/python2.4/pip-1.4-py2.4.egg/pip/__init__.py",line 10,in ?
from pip.util import get_installed_distributions,get_prog
File "/home/ckoziak/lib/python2.4/pip-1.4-py2.4.egg/pip/util.py",line 17,in ?
from pip.vendor.distlib import version
File "/home/ckoziak/lib/python2.4/pip-1.4-py2.4.egg/pip/vendor/__init__.py",line 8
from __future__ import absolute_import
SyntaxError: from __future__ imports must occur at the beginning of the file

‘south’is在我的设置文件中.我有一个本地和现场版本__init__joining他们

__在里面__:

from .base import *

try:
    from .local import *
except:
    pass

try:
    from .live import *
except:
    pass

.local(设置文件),减去db信息:

MEDIA_ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),"static","media")

STATIC_ROOT =  os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),"static-only")

STATICFILES_Dirs = (
    os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),"static"),)

TEMPLATE_Dirs = (
    os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),"templates"),)
INSTALLED_APPS = (
''django.contrib.auth'',''django.contrib.contenttypes'',''django.contrib.sessions'',''django.contrib.sites'',''django.contrib.messages'',''django.contrib.staticfiles'',# Uncomment the next line to enable the admin:
''django.contrib.admin'',# Uncomment the next line to enable admin documentation:
''django.contrib.admindocs'',''south'',''join'',)

.live(设置文件)尚未设置数据库:

MEDIA_ROOT = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),)

INSTALLED_APPS = (
    ''django.contrib.auth'',# Uncomment the next line to enable the admin:
    ''django.contrib.admin'',# Uncomment the next line to enable admin documentation:
    ''django.contrib.admindocs'',)

解决方法

错误消息说您已安装到Python 2.4南部.

你应该安装南到python 2.7.

from bs4 import BeautifulSoup 报错

from bs4 import BeautifulSoup 报错

一: BeautifulSoup的安装:

  下载地址:https://www.crummy.com/software/BeautifulSoup/bs4/download/4.6/

  下载后,解压缩,然后放到Python目录中。

  我是Windows安装Python3.6,目录:D:\Python\Python37

  把解压缩的文件放到这里,  

  很关键的一点:

  一定要把带版本号的文件夹直接放在这里,而不要你下载的或者解压缩的那个自己命名的文件夹!!!我就是因为把自己命名的文件夹直接放到python目录下,然后安装后无法使用的!

  安装步骤:

  cmd>进入命令行界面,输入 cd 空格 加路径,D:\Python\Python37\beautifulsoup4-4.6.3

  >python setup.py build 
  >python setup.py install

  最后出现Finished processing dependencies for beautifulsoup4=4.4.1就OK了。

 

二,如果 from bs4 import BeautifulSoup  还是报错的话,可以试下以下方法:(本人就是用这个解决的 - _ - )

 

    首先,我使用的IDE是PyCharm Python 2018 3.1版本,在file选项中选择settings选项点进去

    

     然后选择 Project Interpreter

 

      

      双击 pip 点进去

      

      搜索 bs4 点击   然后点击 Install Package 等会即可。

 

       

 

import OAuth2Authentication ImportError:没有名为“ oauth2_provider.ext”的模块

import OAuth2Authentication ImportError:没有名为“ oauth2_provider.ext”的模块

由➡️pip install django-rest-framework-social-oauth2解决

不是那个导致错误的版本▶️django-rest-framework-social-oauth2 == 1.0.4 错误消失了

我们今天的关于ImportError:没有名为 bs4 的模块BeautifulSoup的分享就到这里,谢谢您的阅读,如果想了解更多关于BeautifulSoup 已安装但仍出现 ImportError: No module named BeautifulSoup、django – ImportError:没有名为south的模块、from bs4 import BeautifulSoup 报错、import OAuth2Authentication ImportError:没有名为“ oauth2_provider.ext”的模块的相关信息,可以在本站进行搜索。

本文标签: