Python 使用pipenv安装bs4时出错

Python 使用pipenv安装bs4时出错,python,beautifulsoup,pip,pipenv,Python,Beautifulsoup,Pip,Pipenv,我想在虚拟环境中安装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 fro

我想在虚拟环境中安装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
C:\Users\ACER\Desktop\PYTEST\temp>pipenv安装beautifulsoup4
正在安装beautifulsoup4…
正在将beautifulsoup4添加到Pipfile的[packages]…
安装成功
正在从Pipfile.lock(06c5f2)安装依赖项…
安装beautifulsoup==3.2.2--hash=sha256:a04169602bff6e3138b1259dbbf491f5a27f9499dea9a8fbafd48843f9d89970时出错--hash=sha256:d31413d71f6ca027ff6b06c891b62ee8ff48267ccd969f881d810e5d1fe49565!我会再试一次。
================================ 9/9 - 00:00:05
安装最初失败的依赖项…
[pipenv.exceptions.InstallError]:文件“c:\users\acer\appdata\local\programs\python\python37\lib\site packages\pipenv\core.py”,第1992行,在do\U安装中
[pipenv.exceptions.InstallError]:跳过锁定=跳过锁定,
[pipenv.exceptions.InstallError]:文件“c:\users\acer\appdata\local\programs\python\python37\lib\site packages\pipenv\core.py”,第1253行,在do_init中
[pipenv.exceptions.InstallError]:pypi_mirror=pypi_mirror,
[pipenv.exceptions.InstallError]:文件“c:\users\acer\appdata\local\programs\python\python37\lib\site packages\pipenv\core.py”,第859行,在do\U安装依赖项中
[pipenv.exceptions.InstallError]:重试列表、过程、失败的步骤、队列、要求、目录、**安装
[pipenv.exceptions.InstallError]:文件“c:\users\acer\appdata\local\programs\python\python37\lib\site packages\pipenv\core.py”,第763行,批量安装
[pipenv.exceptions.InstallError]:_cleanup_procs(procs,非阻塞,失败的_deps_队列,重试=重试)
[pipenv.exceptions.InstallError]:文件“c:\users\acer\appdata\local\programs\python\python37\lib\site packages\pipenv\core.py”,第681行,在清理过程中
[pipenv.exceptions.InstallError]:引发异常.InstallError(c.dep.name,extra=err\u行)
[pipenv.exceptions.InstallError]:['Collection beautifulsoup==3.2.2','使用缓存https://files.pythonhosted.org/packages/40/f2/6c9f2f3e696ee6a1fb0e4d7850617e224ed2b0b1e872110abffeca2a09d4/BeautifulSoup-3.2.2.tar.gz']
[pipenv.exceptions.InstallError]:[“错误:命令出错,退出状态为1:”,“命令:\'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-WQ523G\\\\\\\\\\\\\\\\\\\\\\\\beautifulsoup\\\\\\\\\\\\\\\\该文件的一名名名名名为为““““““““““\”””“““““““\”C”C”C:\\\\\\\\\ \ \ \”C C”文件文件文件名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名名\'exec\'“\'””))\“egg_info--egg base\\C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-wjnq523g\\beautifulsop\\pip egg info\'”,“cwd:C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-wjnq523g\\beautifulsop\”,“完整输出(6行):“回溯(最后一次调用)”,“文件”,第1行,in,,“文件”“C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-wjnq523g\\beautifulsoup\\setup.py”,第3行,“您试图在Python 3下运行一个非常旧的Beauty Soup版本。这将不起作用。”“请使用Beauty Soup 4,可通过pip软件包‘beautifulsoup4\'获得。”。“,”,“^”,“SyntaxError:无效语法“,”-----------------------------------------“,“错误:命令出错,退出状态为1:python setup.py egg_info检查日志以获取完整的命令输出。”]
错误:错误:包安装失败。。。
================================ 0/1 - 00:00:02

错误消息格式不正确,但信息在那里

“您正试图在Python 3下运行非常旧版本的Beautiful Soup。这将不起作用。”“请使用Beautiful Soup 4,可通过pip软件包‘beautifulsoup4’获得。”


此外,在跟踪开始时,它清楚地表明它正在尝试安装
beautifulsoup
,显然是因为它位于
Pipfile.lock
中。显然,您想要的是
beautifulsoup4
。只要解决这个问题,您就可以开始了。

pipenv
已成功安装了
beautifulsoup4
,如跟踪中所示:

正在安装beautifulsoup4…
正在将beautifulsoup4添加到Pipfile的[packages]…
安装成功

pipenv
尝试完成以前失败的依赖项的安装时,此错误发生在之后,在本例中为
beautifulsoup3.2.2
。要解决此问题,应使用以下方法从
Pipfile.lock
依赖项中删除旧版本的
beautifulsoup


pipenv卸载beautifulsoup

刚刚出现了这个问题,从我的PIP文件中删除“beautifulsoup”解决了这个问题