我曾经使用命令pip3 install module_name来安装任何模块,并且该模块正在运行.但是突然我尝试安装某些东西时出现以下错误.
I used to inuput the command pip3 install module_name to install any module and it was working. But suddenly I have the following error when I try to install something.
Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/bin/pip", line 10, in <module> sys.exit(main()) TypeError: 'module' object is not callable有人知道为什么会发生此错误,请问如何解决?
Do somebody know why this error occurs and how I can solve it please?
推荐答案您要使用python -m pip install <module>,因为python命令将利用特定的解释器.但是,pip本身可以指向任意数量的pip二进制文件,这些二进制文件可以指向未知的解释器.因此,最好的办法是指定解释器.
You want to use python -m pip install <module> because the python command will leverage a specific interpreter. However, pip by itself could point to any number of pip binaries, which could point to unknown interpreters. So, best thing to do is to specify the interpreter.
具体地说,-m标志指示我想从指定的python调用模块". pip不是您可以执行此操作的唯一模块:
Specifically, the -m flag says "I want to call a module from the python I have specified." pip is not the only module you can do this with:
python -m timeit python -m zipfile python -m pip您可以使用-V标志检查pip指向的位置:
You can check where pip is pointing by using the -V flag:
python -m pip -V pip 19.2.2 from /Users/mm92400/anaconda3/lib/python3.6/site-packages/pip (python 3.6)更多推荐
使用pip安装Python模块
发布评论