python - 无法将 Beautiful Soup 安装到 Python 2,因为我已经在我的 Python 3 中安装了它,但我也无法导入或卸载它
问题描述
我最近不得不恢复到 Python 2.7 才能在 ArcMap 中工作。我尝试安装 Beautiful Soup,但由于我已经在 Python 3 中安装了它,它声称“要求已经满足”;但是,我不能导入任何模块,因为它当然是安装在 Python 3 中而不是 Python 2 中。
我试过卸载了,又找不到了。捕获 22。
尝试安装 -
d:\egm722>pip install beautifulsoup4
已满足要求:c:\users\geo\appdata\local\prog rams\python\python37-32\lib\site-packages 中的 beautifulsoup4 (4.6.3)
尝试进口——
import bs4 Traceback(最近一次调用最后一次):文件“”,第 1 行,在 ImportError 中:没有名为 bs4 的模块来自 bs4 import beautifulsoup Traceback(最近一次调用最后一次):文件“”,第 1 行,在 ImportError 中:没有名为 bs4 的模块
尝试卸载 -
d:\egm722>pip uninstall BeautifulSoup 跳过 BeautifulSoup,因为它没有安装。
我宁愿不恢复到 Python 3 并从那里卸载,所以任何关于如何在我目前的状态下执行它的建议将不胜感激。当谈到 Python 时,我是一个新手,尤其是不同的环境,所以请放轻松。
解决方案
您需要具体说明pip
您要使用哪个,以确保使用与您的 Python 2 安装相关联的那个。尝试:
pip2 install beautifulsoup4
或者
python2 -m pip install beautifulsoup4
或者,如果 Python 2 是您系统上的默认 python,您可以运行
python -m pip install beautifulsoup4
推荐阅读
- python - Python 中的 Parket 票务系统
- java - 无法将凌乱的 spring-security-xml 转换为基于 Java 的配置
- sql - 在 SQL 中将日期 (yyyy-mm-dd) 转换为 MM-YYYY
- flutter - Flutter:如何只用它的一个孩子覆盖整个 Column
- python - for循环问题的两种解决方案之间的区别?
- javascript - 开玩笑忽略根目录中的 __mocks__ 目录
- r - 基于一列中的两个值对数据框进行子集
- python - 调用对象的存储方法
- php - 将 CakePHP 与 Wordpress 集成
- swift - 如何使用 swift 在单个消息电报机器人中发送照片、标题和内联按钮?