Python框架pypi包安装问题



我通过终端上的命令行安装了包,成功了,但当我试图在PyCharm中导入包时,我总是收到这样的错误:

Last login: Sun Jun  6 19:24:55 on ttys000
burhancankurt@Burhans-MacBook-Pro ~ % pip install BeautifulSoup
Collecting BeautifulSoup
Using cached BeautifulSoup-3.2.2.tar.gz (32 kB)
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_6dd624c9bbd34395982f465be8a85069/setup.py'"'"'; __file__='"'"'/private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_6dd624c9bbd34395982f465be8a85069/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-pip-egg-info-l3q6t14w
cwd: /private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_6dd624c9bbd34395982f465be8a85069/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_6dd624c9bbd34395982f465be8a85069/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
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/40/f2/6c9f2f3e696ee6a1fb0e4d7850617e224ed2b0b1e872110abffeca2a09d4/BeautifulSoup-3.2.2.tar.gz#sha256=a04169602bff6e3138b1259dbbf491f5a27f9499dea9a8fbafd48843f9d89970 (from https://pypi.org/simple/beautifulsoup/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached BeautifulSoup-3.2.1.tar.gz (31 kB)
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_98803d3a8d934adda7756abe90c5401e/setup.py'"'"'; __file__='"'"'/private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_98803d3a8d934adda7756abe90c5401e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-pip-egg-info-bfpy736n
cwd: /private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_98803d3a8d934adda7756abe90c5401e/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_98803d3a8d934adda7756abe90c5401e/setup.py", line 22
print "Unit tests have failed!"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Unit tests have failed!")?
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/1e/ee/295988deca1a5a7accd783d0dfe14524867e31abb05b6c0eeceee49c759d/BeautifulSoup-3.2.1.tar.gz#sha256=6a8cb4401111e011b579c8c52a51cdab970041cc543814bbd9577a4529fe1cdb (from https://pypi.org/simple/beautifulsoup/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached BeautifulSoup-3.2.0.tar.gz (31 kB)
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_aa9baa5a8f79435f93178e54b626a9b5/setup.py'"'"'; __file__='"'"'/private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_aa9baa5a8f79435f93178e54b626a9b5/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-pip-egg-info-b39f5vpq
cwd: /private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_aa9baa5a8f79435f93178e54b626a9b5/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/dt/0ff9v189515b132txp807hcm0000gn/T/pip-install-aoq6g15x/beautifulsoup_aa9baa5a8f79435f93178e54b626a9b5/setup.py", line 22
print "Unit tests have failed!"
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Unit tests have failed!")?
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/33/fe/15326560884f20d792d3ffc7fe8f639aab88647c9d46509a240d9bfbb6b1/BeautifulSoup-3.2.0.tar.gz#sha256=0dc52d07516c1665c9dd9f0a390a7a054bfb7b147a50b2866fb116b8909dfd37 (from https://pypi.org/simple/beautifulsoup/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement BeautifulSoup (from versions: 3.2.0, 3.2.1, 3.2.2)
ERROR: No matching distribution found for BeautifulSoup
burhancankurt@Burhans-MacBook-Pro ~ % 
  1. 我通过终端更新了pypi
  2. 我通过终端安装了BeautifulSoup包
  3. 我重新启动PyCharm

但不,它不起作用当我写import BeautifulSoup时,当鼠标悬停在红色标记"附近时;安装包";我点击并再次获得上面的错误

命令行中的

已经告诉您应该安装BeautifulSoup4使用该命令

pip3 or pip install BeautifulSoup4

最新更新