Arn*_*Gee 5 python macos terminal pip python-2.7
我有一台 Macbook Air,想要安装 pip。我有更新的Python版本。我按照所有说明进行操作,但无法安装任何软件包。
我已经研究了1个多小时,看了很多文章和问题,但我无法弄清楚。
这是当我尝试安装 pip,然后安装一个名为 beautifulsoup 的包时,终端上显示的内容:
arnau@MacBook-Air-de-Arnau ~ % python --version
Python 2.7.16
arnau@MacBook-Air-de-Arnau ~ % curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1840k 100 1840k 0 0 320k 0 0:00:05 0:00:05 --:--:-- 439k
arnau@MacBook-Air-de-Arnau ~ % python get-pip.py
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Collecting pip
Using cached pip-20.2.2-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.2.2
Uninstalling pip-20.2.2:
Successfully uninstalled pip-20.2.2
WARNING: The scripts pip, pip2 and pip2.7 are installed in '/Users/arnau/Library/Python/2.7/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
NOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications.
Successfully installed pip-20.2.2
arnau@MacBook-Air-de-Arnau ~ % pip install beautifulsoup4
zsh: command not found: pip
arnau@MacBook-Air-de-Arnau ~ %
Run Code Online (Sandbox Code Playgroud)
我不明白发生了什么或我应该做什么来解决该错误。
查看最后的警告,它说这些脚本不在 PATH 中。打开 Finder,将列出的文件复制到以下目录中:/usr/local/bin/
\n转到 /Users/arnau/Library/Python/2.7/bin。将列出的文件复制到 /usr/local/bin/ 中,以便命令行可以识别您的命令 pip。
\n如果您不想执行此操作(我不建议执行此操作),您现在可以简单地使用其他答案,即使用 ,python -m pip
它将命令行定向到当前目录这些文件的 /Users/arnau/Library/Python/2.7/bin。然而,您将来可能会遇到问题,所以我建议了上面的答案。
我还希望您\xe2\x80\x99 不会在每次必须安装软件包时额外键入 2 个关键字。
\n小智 5
尝试下面
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
47333 次 |
最近记录: |