pip no longer working after update error 'module' object is not callable

廉价感情. 提交于 2019-12-17 07:16:09

问题


After a pip update, pip has stopped working completely.

Z:\>pip install matplotlib
Traceback (most recent call last):
  File "c:\program files\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python37\Scripts\pip.exe\__main__.py", line 9, in <module>
TypeError: 'module' object is not callable

Any help please?

Edit: I am working on windows 10


回答1:


All credit for this goes to user han_solo, who left the answer as a comment, instead of as an answer:

Instead of pip install stdlib_list --user

use python -m pip install stdlib_list --user

Replace stdlib_list with matplotlib or whatever the name is of the package you want.




回答2:


I've had the same issue as you, and I solved it uninstalling pip and installing again.

To uninstall: python -m pip uninstall pip

To install, follow the instructions: https://www.liquidweb.com/kb/install-pip-windows/

After that you will going to have a older but functional 19.0.3 version.




回答3:


Similar to what @han_solo said, but if your running python3, instead of using:

python -m pip install stdlib_list --user

try using:

python3 -m pip install stdlib_list --user




回答4:


Have the habit of installing any python packages with pip using python -m, say for installing numpy use below command:

python -m pip install numpy

In case if it errros out with the environment permission error append --user in the same command:

python -m pip install numpy --user



来源:https://stackoverflow.com/questions/58451650/pip-no-longer-working-after-update-error-module-object-is-not-callable

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