首页 > 解决方案 > pip install 出错:“没有名为 pip.__main__ 的模块”

问题描述

在我的电脑(Windows 8.1)上有 python 3.4。当我尝试pip install使用我使用的代码安装模块时:

py -m pip install ...

但是命令行返回以下错误:

C:\Python34\python.exe: No module named pip.__main__; 'pip' is a package and cannot be directly exec
uted

标签: python-3.x

解决方案


Pip 不是一个独立的可执行文件。它是一个python模块。所以事实上你可以做到这一点(用numpy测试,按要求正常工作):

python -m pip install numpy

好吧,您应该看到有关Python的文档。我确实提到 Pip 是一个独立的可执行文件。如果它在你的路径中,那么你也可以这样做:

pip install numpy

确保 python 在你的路径中。


推荐阅读