Guido_PSG
2021-07-31 10:06
采纳率: 50%
浏览 130
已结题

乌班图中 python3.5中pip语法错误

背景:使用虚拟环境创建了一个叫myDjango的环境,创建好后使用pip list出现语法错误。

1、Traceback (most recent call last):
File "/home/python/.virtualenvs/myDjango/bin/pip", line 7, in
from pip._internal.cli.main import main
File "/home/python/.virtualenvs/myDjango/lib/python3.5/site-packages/pip/_internal/cli/main.py", line 57
sys.stderr.write(f"ERROR: {exc}")
^

2、参考其他人的解决办法:
(1)wget https://bootstrap.pypa.io/pip/3.5/get-pip.py
(2)python3 get-pip.py

3、第二步(1)可以下载,但是(2)仍然报错:
Traceback (most recent call last):
File "get-pip.py", line 23974, in
main()
File "get-pip.py", line 199, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 121, in bootstrap
import setuptools # noqa
File "/home/python/.virtualenvs/myDjango/lib/python3.5/site-packages/setuptools/init.py", line 18, in
from setuptools.dist import Distribution
File "/home/python/.virtualenvs/myDjango/lib/python3.5/site-packages/setuptools/dist.py", line 585
license_files: Optional[List[str]] = self.metadata.license_files
^
SyntaxError: invalid syntax

img

  • 收藏

2条回答 默认 最新

  • Guido_PSG 2021-07-31 10:36
    已采纳

    我将虚拟环境的python改为3.6版本的,就可以了

    已采纳该答案
    打赏 评论
  • 浪客 2021-07-31 10:18

    使用 python3 -m pip install --upgrade pip 升级安装一下看看

    打赏 评论

相关推荐 更多相似问题