简体   繁体   English

python安装路径

[英]python installation path

I've tried making a package for my python project, and this has an sh script that does some post install python setup.py install for some dependencies/subprojects.我已经尝试为我的 python 项目制作一个 package,并且这有一个 sh 脚本,可以为一些依赖项/子项目安装 python setup.py 安装。 But turns out that MacOS installer creates it's own context and screws up some paths so going simply:但事实证明,MacOS 安装程序创建了它自己的上下文并搞砸了一些路径,所以很简单:

  python setup.py install - won't work

One solution that seems to help is to do:一种似乎有帮助的解决方案是:

  usr/local/bin/python setup.py install

Now I'm kind of a newbie to MacOS so here are my questions:现在我是 MacOS 的新手,所以这是我的问题:

  1. Is this the default/standard location of python?这是 python 的默认/标准位置吗? What I mean is that I plan to distribute this package so can I expect that a machine that has python installed will have a usr/local/bin/python?我的意思是我计划分发这个 package 所以我可以期望安装了 python 的机器会有一个 usr/local/bin/python 吗?
  2. In case that the answer to 1. is no, how could I get the location to their python installation?如果 1. 的答案是否定的,我怎么能找到他们 python 安装的位置? $PATH contains a lot more and $PYTHONPATH is not what I'm looking for either. $PATH 包含更多内容,而 $PYTHONPATH 也不是我想要的。

Regards, Bogdan问候, 博格丹

You most certainly can not assume that python is installed there.您当然不能假设 python 安装在那里。 If python is properly installed, it should be in the $PATH , otherewise you just can't know.如果 python 安装正确,它应该在$PATH中,否则你无法知道。 I could have installed it at /whatever/snake-program/ , if it wasn't in the path, how could you guess?我可以将它安装在/whatever/snake-program/ ,如果它不在路径中,你怎么能猜到?

EDIT: What do you mean $PATH contains a lot more by the way?编辑:你是什么意思$PATH顺便说一句包含更多? As long as there aren't more than one python install, that shouldn't matter.只要安装的 python 不超过一个,那没关系。

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

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