简体   繁体   中英

pip install is giving ModuleNotFoundError

I am using miniconda version of python and I've create virtual environment using virtualenv command. Initially pip install command was working fine but after sometime it started giving me ModuleNotFoundError

when I called the command to install jupyter notebook.

pip install jupyter

and I also tried

pip3 install jupyter

even pip list command is not working.

error which I got was

Traceback (most recent call last):
  File "/Users/aarsh/Code/p/bin/pip", line 8, in <module>
    sys.exit(main())
  File "/Users/aarsh/Code/p/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 73, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/Users/aarsh/Code/p/lib/python3.8/site-packages/pip/_internal/commands/__init__.py", line 104, in create_command
    module = importlib.import_module(module_path)
  File "/Users/aarsh/opt/miniconda3/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/aarsh/Code/p/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 17, in <module>
    from pip._internal.cli.req_command import RequirementCommand, with_cleanup
  File "/Users/aarsh/Code/p/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 19, in <module>
    from pip._internal.network.download import Downloader
  File "/Users/aarsh/Code/p/lib/python3.8/site-packages/pip/_internal/network/download.py", line 13, in <module>
    from pip._internal.network.cache import is_from_cache
  File "/Users/aarsh/Code/p/lib/python3.8/site-packages/pip/_internal/network/cache.py", line 7, in <module>
    from pip._vendor.cachecontrol.cache import BaseCache
ModuleNotFoundError: No module named 'pip._vendor.cachecontrol'

Please Help me to solve this problem.

I found the same problem mentioned in pip and pip3 no longer work

The solution was to reinstall and upgrade pip

ls .local/lib/python3.5/sitepackages
pip dist-packages
ls  .local/lib/python2.7/sitepackages
pip dist-packages

Then

sudo pip3 install --force-reinstall --upgrade pip
sudo pip install --force-reinstall --upgrade pip

The mentioned command are for linux-based, you might need different cmd for windows

尝试: pip install notebookpip3 install notebook如果您没有 pip,请尝试: conda install notebook

try this: pip install jupyterlab
try pip3 if pip doesn't work: pip3 install jupyterlab

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM