背景:使用虚拟环境创建了一个叫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