Python:PIP 安装路径,此插件和其他插件的正确位置是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18022646/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 09:44:24  来源:igfitidea点击:

Python: PIP install path, what is the correct location for this and other addons?

pythonpython-2.7pip

提问by Deepend

I have recently had a few problems with my Python installation and as a result I have just reinstalled python and am trying to get all my addons working correctly as well. I'm going to look at virtualenv after to see if I can prevent this from happening again.

我最近在安装 Python 时遇到了一些问题,因此我刚刚重新安装了 python 并试图让我的所有插件也正常工作。之后我将查看 virtualenv,看看是否可以防止这种情况再次发生。

When I type which pythoninto terminal I now get

当我输入which python终端时,我现在得到

/Library/Frameworks/Python.framework/Versions/2.7/bin/python

I understand this to be the correct location and now want to get all the rest of my addons installed correctly as well.

我知道这是正确的位置,现在也希望正确安装所有其他插件。

However after installing pip via sudo easy_install pipand type which pipi get

但是在安装 pip viasudo easy_install pip并输入后which pip我得到

/usr/local/bin/pip

Is this correct? I would have thought it should reflect the below

这样对吗?我本以为它应该反映以下内容

/Library/Python/2.7/site-packages/

There is a folder in here called pip-1.4-py2.7.egg which was not there prior to instillation but the above path does not give me any confidence.

这里有一个名为 pip-1.4-py2.7.egg 的文件夹,它在灌输之前并不存在,但上述路径并没有给我任何信心。

Where should pip and my other addons such as Distribute, Flask and Boto be installed if I want to set this up correctly?

如果我想正确设置它,应该在哪里安装 pip 和我的其他插件,例如 Distribute、Flask 和 Boto?

Mac OSX 10.7, Python 2.7

Mac OSX 10.7,Python 2.7

采纳答案by sagarchalise

Since pipis an executable and whichreturns path of executables or filenames in environment. It is correct. Pip module is installed in site-packages but the executable is installed in bin.

因为pip是一个可执行文件并which返回环境中可执行文件或文件名的路径。它是正确的。Pip 模块安装在 site-packages 中,但可执行文件安装在 bin 中。

回答by Burhan Khalid

Modules go in site-packagesand executables go in your system's executable path. For your environment, this path is /usr/local/bin/.

模块进入,site-packages可执行文件进入系统的可执行路径。对于您的环境,此路径是/usr/local/bin/.

To avoid having to deal with this, simply use easy_install, distributeor pip. These tools know which files need to go where.

为避免处理这个问题,只需使用easy_install,distributepip。这些工具知道哪些文件需要去哪里。

回答by joeblow23

Also, when you uninstall the package, the first item listed is the directory to the executable.

此外,当您卸载软件包时,列出的第一项是可执行文件的目录。