每当我尝试点安装任何东西时,都会反复出现此错误。 Idk怎么了。请帮忙:)
操作系统:Linux
Python版本:3.8.2
错误突出显示:
Thanks to:
%(__credits__)s""" % globals()
^
SyntaxError: invalid syntax
完全正确的错误:
pip help
Traceback (most recent call last):
File "/home/root/.local/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/home/root/.local/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/root/.local/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/root/.local/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/root/.local/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "/home/root/.local/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py", line 12, in <module>
from pip._internal.utils.logging import get_indentation
File "/home/root/.local/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 18, in <module>
from pip._internal.utils.misc import ensure_dir
File "/home/root/.local/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 20, in <module>
from pip._vendor import pkg_resources
File "/home/root/.local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3252, in <module>
def _initialize_master_working_set():
File "/home/root/.local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3235, in _call_aside
f(*args, **kwargs)
File "/home/root/.local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3277, in _initialize_master_working_set
tuple(
File "/home/root/.local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3278, in <genexpr>
dist.activate(replace=False)
File "/home/root/.local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2785, in activate
declare_namespace(pkg)
File "/home/root/.local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2284, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/root/.local/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2217, in _handle_ns
loader.load_module(packageName)
File "/home/root/.local/lib/python3.8/site-packages/pygoogle/google.py", line 118
print """PyGoogle %(__version__)s
%(__copyright__)s
released %(__date__)s
Thanks to:
%(__credits__)s""" % globals()
^
SyntaxError: invalid syntaxThanks to:
%(__credits__)s""" % globals()
^
SyntaxError: invalid syntax
编辑:pip3给出了相同的错误。
答案 0 :(得分:0)
我在自己的Python3安装上对此进行了测试,因为我暂时不使用它。这是一个非常彻底的解决方案:
pip
中安装了哪些软件包
.local/bin/
和.local/lib/pythonxxx/
,其中xxx
可能是3.8
或干脆将它们移开。我把它们复制到一个临时的
目录,而不是将它们移回原处,只是要记住什么
在那里。.local/bin
和.local/lib/python*
https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
您现在有了一个干净的python3 pip环境,并可以使用
使用pip3
丢失的任何内容。
答案 1 :(得分:0)
您正在运行哪个Linux发行版?我最近了解到,简单的pip install <module name>
不能很好地发挥RHEL的作用。建议以python3 -m pip3 install <module name>
的身份运行它。