在Debian服务器中,当我使用pip安装boto3时,出现以下错误:
$ python3.2 -m pip install boto3
Traceback (most recent call last):
File "/usr/lib/python3.2/runpy.py", line 161, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python3.2/runpy.py", line 74, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.2/dist-packages/pip/__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/cli/cmdoptions.py", line 17, in <module>
from pip._internal.locations import USER_CACHE_DIR, src_prefix
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/locations.py", line 13, in <module>
from pip._internal.utils import appdirs
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/utils/appdirs.py", line 12, in <module>
from pip._internal.utils.compat import WINDOWS, expanduser
File "/usr/local/lib/python3.2/dist-packages/pip/_internal/utils/compat.py", line 62
return u"".join(u"\\x%x" % c for c in raw_bytes), err.end
^
SyntaxError: invalid syntax
注意:点子版本为18.1
答案 0 :(得分:0)
我知道了。 python3.2不支持语法- u“”。join 。
pip3(与pip3.2相同)在运行安装boto3的脚本时遇到了语法并引发了异常。
我安装了python 3.6,并在运行“ pip3.6 install boto3”时有效。
注意:我的python项目是一个新的小型项目,因此从python3.2更改为python3.6并没有太大影响,但是对于大型项目或现有项目,这可能不可行。只希望任何可能遇到这种情况的人都知道导致此问题的原因。