使用pip安装Python模块

编程入门 行业动态 更新时间:2024-10-12 14:17:58
本文介绍了使用pip安装Python模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我曾经使用命令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模块

本文发布于:2023-06-11 03:32:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/625757.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模块   pip   Python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!