简体   繁体   English

为什么 pip install 模块在 /usr/local/lib/python3.4/dist-packages

[英]why pip install module in /usr/local/lib/python3.4/dist-packages

I want to install easydict module for python2.7 and I use the following command:我想为 python2.7 安装easydict模块,我使用以下命令:

sudo pip install easydict

and I find the easydict module is installed in the python3 dir:我发现easydict模块安装在python3目录中:

Downloading/unpacking easydict
  Downloading easydict-1.6.zip
  Running setup.py (path:/tmp/pip-build-hdy25apc/easydict/setup.py) egg_info for package easydict

Installing collected packages: easydict
  Running setup.py install for easydict

  Could not find .egg-info directory in install record for easydict
Successfully installed easydict
Cleaning up...
sudo pip install easydict
Requirement already satisfied (use --upgrade to upgrade): easydict in /usr/local/lib/python3.4/dist-packages
Cleaning up...

Why does this happen?为什么会发生这种情况? Thank you very much.非常感谢。

It depends on your system path.这取决于您的系统路径。 If system path has path of pip binary or python binary of 3.x prior to the path of 2.x versions.如果系统路径在 2.x 版本的路径之前具有 3.x 的 pip 二进制文件或 python 二进制文件的路径。 Then 3.x takes preference over 2.x然后 3.x 优先于 2.x

Please re-arrange your system path to have 2.x paths before 3.x paths请重新安排您的系统路径,使其在 3.x 路径之前具有 2.x 路径

Your pip is pointing to python3, To change the pip pointing to python2 do the following您的 pip 指向 python3,要更改指向 python2 的 pip,请执行以下操作

First remove python pip首先删除python pip

sudo apt-get remove python-pip

make python3 to point python 2.7使 python3 指向 python 2.7

alias python3=python

now if you type python3 in terminal you can see python 2.7 showing up现在如果你在终端中输入 python3 你可以看到 python 2.7 出现

Then install python-pip然后安装python-pip

sudo apt-get install python-pip

If you type pip you can see pip pointing to python 2.7如果你输入 pip 你可以看到 pip 指向 python 2.7

now point python3 to python3现在将 python3 指向 python3

alias python3=python3

Because you are using the pip3, you can use which find where is the pip因为你用的是pip3,所以可以用which find pip在哪里

#which pip
/usr/local/bin/pip

maybe you can find the pip2 or pip2.7 in the same dir也许你可以在同一个目录中找到 pip2 或 pip2.7

#pip2 -V
pip 20.2.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

so you should use pip2 to install module所以你应该使用 pip2 来安装模块

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 pip将2.7个软件包安装到/usr/local/lib/python3.2/dist-packages中 - pip installs 2.7 packages into /usr/local/lib/python3.2/dist-packages 如何在appengine app中使用/usr/local/lib/python2.7/dist-packages中的模块 - How to use module from /usr/local/lib/python2.7/dist-packages in appengine app /usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43:未来警告: - /usr/local/lib/python3.7/dist-packages/seaborn/_decorators.py:43: FutureWarning: IOError:[Errno 13]权限被拒绝:'/usr/local/lib/python2.7/dist-packages/finsymbols/SP500.html' - IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/finsymbols/SP500.html' OSError:[Errno 2]没有这样的文件或目录:'/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg' - OSError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/pyduino-0.0.0-py2.7.egg' ImportError:无法从“变压器”(/usr/local/lib/python3.7/dist-packages/transformers/__init__.py)导入名称“BigBirdTokenizer” - ImportError: cannot import name 'BigBirdTokenizer' from 'transformers' (/usr/local/lib/python3.7/dist-packages/transformers/__init__.py) 错误:无法创建'/usr/local/lib/python2.7/dist-packages/virtualenv_support':权限被拒绝 - error: could not create '/usr/local/lib/python2.7/dist-packages/virtualenv_support': Permission denied 无法获取绘图 /usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:3: MatplotlibDeprecationWarning: - Unable to get plot /usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:3: MatplotlibDeprecationWarning: PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/grpc/__init__.py' - PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.8/dist-packages/grpc/__init__.py' 如何从/usr/lib/python2.7/dist-packages/中的dir获取源软件包 - How to get source packages from dir in /usr/lib/python2.7/dist-packages/
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM