[英]how to install modules to python 2.7 on mac
I tried to install these two modules我尝试安装这两个模块
pip install opencv-python==3.4.2.16
pip install opencv-contrib-python==3.4.2.16
Before install, I switched from python 3 to python 2.7 in the VS code.在安装之前,我在 VS 代码中从 python 3 切换到 python 2.7。 because I want to install these two modules to python 2.7 and run with python 2.7.
因为我想将这两个模块安装到python 2.7并使用python 2.7运行。
I check pip freeze
, But 2 modules is not there.我检查了
pip freeze
,但没有 2 个模块。
I check pip version, output looks like this我检查 pip 版本,输出看起来像这样
pip --version
pip 19.2.2 from /Users/donperera/Library/Python/3.7/lib/python/site-packages/pip (python 3.7)
How to install these 2 modules on to python 2.7 and run the project with python 2.7?如何将这 2 个模块安装到 python 2.7 并使用 python 2.7 运行项目?
Vscode doesn't effect pip because it is a command line app. Vscode 不会影响 pip,因为它是一个命令行应用程序。
First like the comment says, type python2 -m ensurepip
If this doesn't work see https://docs.python.org/2.7/library/ensurepip.html首先像评论说的那样,输入
python2 -m ensurepip
如果这不起作用,请参阅https://docs.python.org/2.7/library/ensurepip.html
Then This is because the default python on your machine is 3.7.那么这是因为你机器上的默认python是3.7。 Try typing in the terminal
python2 -m pip install <module or package >
尝试在终端输入
python2 -m pip install <module or package >
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.