gpt4 book ai didi

pip - pip安装时出现 '/usr/bin/python: No module named pip'如何处理?

转载 作者:行者123 更新时间:2023-12-05 08:05:51 25 4
gpt4 key购买 nike

我在 MacOS 上运行“which pip”或“pip -V”,它给了我以下位置:

pip 20.2.1 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8)

但是,当我尝试执行 'python -m pip install --user pygame' 时,它显示 '/usr/bin/python: No module named pip'

遇到过这个问题的人知道如何解决这个问题吗?

更新:

当我执行“python3 -m pip install --user pygame”或“python3 install pygame”时出现以下错误:

ERROR: Command errored out with exit status 1:command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -u -c'import sys, setuptools, tokenize; sys.argv[0] ='"'"'/private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-install-6wyn2mh9/pygame/setup.py'"'"';file='"'"'/private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-install-6wyn2mh9/pygame/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))'install --record/private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-record-yyyazq6a/install-record.txt--single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pygamecwd: /private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-install-6wyn2mh9/pygame/Complete output (218 lines):......... ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -u -c'import sys, setuptools, tokenize; sys.argv[0] ='"'"'/private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-install-6wyn2mh9/pygame/setup.py'"'"';file='"'"'/private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-install-6wyn2mh9/pygame/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))'install --record/private/var/folders/g9/77451rtd0vj7grc2_lz66tc80000gn/T/pip-record-yyyazq6a/install-record.txt--single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.8/include/python3.8/pygameCheck the logs for full command output.

最佳答案

我想你是 ubuntu 或任何其他 Linux 发行版。我遇到过同样的错误,但很容易解决。使用此命令安装 pip:

sudo apt-get install python3-pip

然后始终键入 pip3 而不是 pip。所以如果你想安装 pygame,使用这个:

pip3 install pygame

而不是这个:

pip install pygame

关于pip - pip安装时出现 '/usr/bin/python: No module named pip'如何处理?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63276042/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com