python 虚拟环境与系统 python 版本不同并安装包

python 虚拟环境与系统 python 版本不同并安装包

我使用 virtualenv 创建了一个 python 3.9.7 虚拟环境。这与我的系统 python 版本不同。当我尝试通过安装 jupyter 时,pip install jupyter出现以下错误:

Traceback (most recent call last):
  File "/usr/bin/Python-3.9.7/Lib/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/bin/Python-3.9.7/Lib/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/__main__.py", line 16, in <module>
    from pip._internal.cli.main import main as _main  # isort:skip # noqa
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
    from pip._internal.exceptions import CommandError
  File "/home/kmdreve/jupyter_notebook/kmdreve3.9/lib/python3.9/site-packages/pip/_internal/exceptions.py", line 10, in <module>
    from pip._vendor.six import iteritems
ModuleNotFoundError: No module named 'pip._vendor.six'

我怎样才能解决这个问题?

谢谢你!

相关内容