我想在虚拟环境上安装bs4,但是发生错误,我不知道为什么。
我已经更新了bs4,pip和pipenv。
这是错误:
C:\Users\ACER\Desktop\PYTEST\temp>pipenv install beautifulsoup4
Installing beautifulsoup4…
Adding beautifulsoup4 to Pipfile's [packages]…
Installation Succeeded
Installing dependencies from Pipfile.lock (06c5f2)…
An error occurred while installing beautifulsoup==3.2.2 --hash=sha256:a04169602bff6e3138b1259dbbf491f5a27f9499dea9a8fbafd48843f9d89970 --hash=sha256:d31413d71f6ca027ff6b06c891b62ee8ff48267ccd969f881d810e5d1fe49565! Will try again.
================================ 9/9 - 00:00:05
Installing initially failed dependencies…
[pipenv.exceptions.InstallError]: File "c:\users\acer\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 1992, in do_install
[pipenv.exceptions.InstallError]: skip_lock=skip_lock,
[pipenv.exceptions.InstallError]: File "c:\users\acer\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 1253, in do_init
[pipenv.exceptions.InstallError]: pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]: File "c:\users\acer\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 859, in do_install_dependencies
[pipenv.exceptions.InstallError]: retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[pipenv.exceptions.InstallError]: File "c:\users\acer\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 763, in batch_install
[pipenv.exceptions.InstallError]: _cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
[pipenv.exceptions.InstallError]: File "c:\users\acer\appdata\local\programs\python\python37\lib\site-packages\pipenv\core.py", line 681, in _cleanup_procs
[pipenv.exceptions.InstallError]: raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: ['Collecting beautifulsoup==3.2.2', ' Using cached https://files.pythonhosted.org/packages/40/f2/6c9f2f3e696ee6a1fb0e4d7850617e224ed2b0b1e872110abffeca2a09d4/BeautifulSoup-3.2.2.tar.gz']
[pipenv.exceptions.InstallError]: ['ERROR: Command errored out with exit status 1:', ' command: \'c:\\users\\acer\\.virtualenvs\\temp-mutvn0yg\\scripts\\python.exe\' -c \'import sys, setuptools, tokenize; sys.argv[0] = \'"\'"\'C:\\\\Users\\\\ACER\\\\AppData\\\\Local\\\\Temp\\\\pip-install-wjnq523g\\\\beautifulsoup\\\\setup.py\'"\'"\'; __file__=\'"\'"\'C:\\\\Users\\\\ACER\\\\AppData\\\\Local\\\\Temp\\\\pip-install-wjnq523g\\\\beautifulsoup\\\\setup.py\'"\'"\';f=getattr(tokenize, \'"\'"\'open\'"\'"\', open)(__file__);code=f.read().replace(\'"\'"\'\\r\\n\'"\'"\', \'"\'"\'\\n\'"\'"\');f.close();exec(compile(code, __file__, \'"\'"\'exec\'"\'"\'))\' egg_info --egg-base \'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-wjnq523g\\beautifulsoup\\pip-egg-info\'', ' cwd: C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-wjnq523g\\beautifulsoup\\', ' Complete output (6 lines):', ' Traceback (most recent call last):', ' File "<string>", line 1, in <module>', ' File "C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-wjnq523g\\beautifulsoup\\setup.py", line 3', ' "You\'re trying to run a very old release of Beautiful Soup under Python 3. This will not work."<>"Please use Beautiful Soup 4, available through the pip package \'beautifulsoup4\'."', ' ^', ' SyntaxError: invalid syntax', ' ----------------------------------------', 'ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.']
ERROR: ERROR: Package installation failed...
================================ 0/1 - 00:00:02
答案 0 :(得分:1)
错误消息的格式不正确,但是信息在那里...
“您正在尝试在Python 3下运行非常老版本的Beautiful Soup。这将无法正常工作。” <>“请使用Beautiful Soup 4,可通过pip包“ beautifulsoup4 \”获得。” < / p>
此外,在跟踪开始时,它还明确指出它正在尝试安装beautifulsoup
,这显然是因为它位于您的Pipfile.lock
中。显然,您想要beautifulsoup4
代替。只需解决此问题,您就应该做好了。
答案 1 :(得分:0)
SAF_DRV_IDX FST_ACCEL_IDX ACCD
51 2 1
100 0 0
96 2 0
79 2 0
66 18 1
90 0 0
93 4 0
61 21 1
85 8 1
100 0 0
已成功安装pipenv
,如跟踪所示:
正在安装beautifulsoup4…
将beautifulsoup4添加到Pipfile的[程序包]…
安装成功
当beautifulsoup4
试图完成先前失败的依赖关系(在本例中为pipenv
)的安装后,发生错误。要解决此问题,您应该使用以下方法从您的beautifulsoup 3.2.2
依赖项中删除旧版本的beautifulsoup
:
Pipfile.lock
答案 2 :(得分:0)
只有这个问题,从我的Pipfile中删除“ beautifulsoup”就解决了。