Cannot install any packages with pip I got this error ImportError: cannot import name 'appdirs'

﹥>﹥吖頭↗ 提交于 2021-01-28 08:43:51

问题


When I try install any packages with pip or use pip I got the following error:

ImportError: cannot import name 'appdirs'

an Example:

!pip install tweepy
Traceback (most recent call last): 
    File "/Users/user_name/anaconda3/bin/pip", line 6, 
    in <module> from pip._internal.cli.main import main
    File "/Users/user_name/anaconda3/lib/python3.6/site- 
    packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
    File "/Users/user_name/anaconda3/lib/python3.6/site- 
    packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
    File "/Users/user_name/anaconda3/lib/python3.6/site- 
    packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
    File "/Users/user_name/anaconda3/lib/python3.6/site- 
    packages/pip/_internal/cli/cmdoptions.py", line 25, in <module>
    from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
    File "/Users/user_name/anaconda3/lib/python3.6/site- 
    packages/pip/_internal/locations.py", line 19, in <module>
    from pip._internal.utils import appdirs
    File "/Users/user_name/anaconda3/lib/python3.6/site- 
    packages/pip/_internal/utils/appdirs.py", line 13, in <module>
    from pip._vendor import appdirs as _appdirs
    ImportError: cannot import name 'appdirs''''

Another example:

   `pip --version 
    Traceback (most recent call last):
    File "/Users/user_name/anaconda3/bin/pip", line 6, in <module>
from pip._internal.cli.main import main
   File "/Users/user_name/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/main.py", line 10, in <module>
    from pip._internal.cli.autocompletion import autocomplete
    File "/Users/user_name/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
    from pip._internal.cli.main_parser import create_main_parser
    File "/Users/user_name/anaconda3/lib/python3.6/site
    packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
    File "/Users/user_name/anaconda3/lib/python3.6/site-packages/pip/_internal/cli/cmdoptions.py", line 25, in <module>
from pip._internal.locations import USER_CACHE_DIR, get_src_prefix
    File "/Users/user_name/anaconda3/lib/python3.6/site-packages/pip/_internal/locations.py", line 19, in <module>
from pip._internal.utils import appdirs
    File "/Users/user_name/anaconda3/lib/python3.6/site-packages/pip/_internal/utils/appdirs.py", line 13, in <module>
from pip._vendor import appdirs as _appdirs
    ImportError: cannot import name 'appdirs'

How could I fix it? Thank you

来源:https://stackoverflow.com/questions/61611793/cannot-install-any-packages-with-pip-i-got-this-error-importerror-cannot-import

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!