无法安装Beautiful Soup到Python 2,因为我已经在Python 3中安装了它,但我也无法导入或卸载它

问题描述 投票:1回答:1

我最近不得不恢复到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(最近一次调用最后一次):ImportError中的文件“”,第1行:没有来自bs4的名为bs4的模块导入beautifulsoup Traceback(最近调用最后一次):文件“”,第1行,在ImportError中:没有名为bs4的模块

尝试卸载 -

d:\ egm722> pip卸载BeautifulSoup跳过BeautifulSoup,因为它没有安装。

我宁愿不回复Python 3并从那里卸载,所以任何有关如何在我当前状态下执行它的建议将非常感激。对于Python,尤其是不同的环境,我是新手,所以对我来说很容易。

python beautifulsoup
1个回答
1
投票

您需要具体说明要使用的pip,以确保使用与Python 2安装相关联的那个。尝试:

pip2 install beautifulsoup4

要么

python2 -m pip install beautifulsoup4

或者,如果Python 2是您系统上的默认python,则可以运行

python -m pip install beautifulsoup4
© www.soinside.com 2019 - 2024. All rights reserved.