简体   繁体   English

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

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

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. 我最近在我的Python安装上遇到了一些问题,因此我刚刚重新安装了python,并试图使我的所有插件也能正常工作。 I'm going to look at virtualenv after to see if I can prevent this from happening again. 我将在看看virtualenv之后,看看我是否可以阻止这种情况再次发生。

When I type which python into 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 pip and type which pip i get 但是在通过sudo easy_install pip安装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

Modules go in site-packages and executables go in your system's executable path. 模块进入site-packages ,可执行文件进入系统的可执行路径。 For your environment, this path is /usr/local/bin/ . 对于您的环境,此路径为/usr/local/bin/

To avoid having to deal with this, simply use easy_install , distribute or pip . 为避免必须处理此问题,只需使用easy_installdistributepip These tools know which files need to go where. 这些工具知道哪些文件需要去哪里。

Since pip is an executable and which returns path of executables or filenames in environment. 由于pip是一个可执行文件, which返回环境中可执行文件或文件名的路径。 It is correct. 它是正确的。 Pip module is installed in site-packages but the executable is installed in bin. Pip模块安装在site-packages中,但可执行文件安装在bin中。

此外,卸载程序包时,列出的第一个项目是可执行文件的目录。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM