简体   繁体   English

Mac上的Python 3.5.1 Pip安装错误

[英]Python 3.5.1 Pip install error on mac

Installed Python 3.5.1 on Mac. 在Mac上安装了Python 3.5.1。 When I try to download a module from Python's standard library such as pip install BeautifulSoup, I receive the error below: 当我尝试从Python的标准库(例如pip install BeautifulSoup)下载模块时,收到以下错误:

Collecting BeautifulSoup

Using cached BeautifulSoup-3.2.1.tar.gz Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/private/var/folders/bz/2h0jcnq54pzcvjp2x0mhrc6r0000gn/T/pip-build-b_z00926/BeautifulSoup/setup.py", line 22 print "Unit tests have failed!" 使用缓存的BeautifulSoup-3.2.1.tar.gz使用python setup.py命令完成输出:eggback(最近一次调用):文件“ /”,行1中的“ / private / var / folders / bz / 2h0jcnq54pzcvjp2x0mhrc6r0000gn /” T / pip-build-b_z00926 / BeautifulSoup / setup.py”,第22行打印“单元测试失败!” ^ SyntaxError: Missing parentheses in call to 'print' ^ SyntaxError:调用“ print”时缺少括号

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/bz/2h0jcnq54pzcvjp2x0mhrc6r0000gn/T/pip-build-b_z00926/BeautifulSoup/ 命令“ python setup.py egg_info”在/ private / var / folders / bz / 2h0jcnq54pzcvjp2x0mhrc6r0000gn / T / pip-build-b_z00926 / BeautifulSoup /中失败,错误代码为1

That appears to be an old version of BeautifulSoup. 那似乎是BeautifulSoup的旧版本。 Try this instead: 尝试以下方法:

pip install beautifulsoup4

the missing parentheses part might suggest that pip uses python2 by default when you actually need python3 缺少括号的部分可能表明pip在您实际需要python3时默认使用python2

a simple workaround: 一个简单的解决方法:

python3 -m pip install beautifulsoup # or beautifulsoup4

that has the same effect as pip install, but explicitly specifies which python to use 与pip install具有相同的效果,但明确指定要使用的python

Try using pip2 (for Python 2) or pip3 (for Python 3) instead of just pip . 尝试使用pip2 (对于Python 2)或pip3 (对于Python 3),而不只是pip It might be using the wrong version of pip for the Python version you are trying to use. 您尝试使用的Python版本可能使用了错误的pip版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM