setup.py安装位置?
我正在运行 Mac OS X Lion 10.7.1,同时安装了 python 2.6 和 2.7。我已将 2.6 设置为我的默认版本。我正在尝试安装一个软件包,它安装到 2.7。我的设置如下所示:
~:hi› which python
/usr/bin/python
~:hi› python -V
Python 2.6.6
~:hi› python
Python 2.6.6 (r266:84292, Jun 16 2011, 16:59:16)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.prefix
'/System/Library/Frameworks/Python.framework/Versions/2.6'
>>> sys.exec_prefix
'/System/Library/Frameworks/Python.framework/Versions/2.6'
难道它不应该安装在 2.6 站点包中吗?我是否误解了这应该如何运作?
编辑
有问题的包是virtuanenvwrapper
我做了2.6 我的默认版本如下:
默认写入 com.apple.versioner.python 版本 2.6
我尝试像这样安装它:
sudo python setup.py install sudo /usr/bin/python setup.py 安装
I'm running Mac OS X Lion 10.7.1 that has both python 2.6 and 2.7 installed. I've made 2.6 my default version. I am trying to install a package and it installs to 2.7. My setup looks like this:
~:hi› which python
/usr/bin/python
~:hi› python -V
Python 2.6.6
~:hi› python
Python 2.6.6 (r266:84292, Jun 16 2011, 16:59:16)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.prefix
'/System/Library/Frameworks/Python.framework/Versions/2.6'
>>> sys.exec_prefix
'/System/Library/Frameworks/Python.framework/Versions/2.6'
Shouldn't it be installed in 2.6 site-packages? Am I misunderstanding how this ought to work?
Edit
The package in question is virtuanenvwrapper
I made 2.6 my default version like so:
defaults write com.apple.versioner.python Version 2.6
I tried installing it like this:
sudo python setup.py install sudo /usr/bin/python setup.py install
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当
setup.py
安装Python包时,它不关心Apple系统设置。它唯一知道的是您使用哪个版本的 Python 来调用它。如果您说:相同
那么将使用该版本,并且与如果您使用这两个命令中的第一个命令 ,则该软件包是否会像您想要的那样安装在 2.6 下?我的猜测是,
sudo
运行的 shell 可能会将 2.7 作为默认值,无论您的普通 shell 想使用哪种 Python。如果你说:When
setup.py
installs a Python package, it pays no attention to the Apple system settings. The only thing it knows is what version of Python you use to invoke it. If you say:then that version gets used, and the same with
If you use the first of these two commands, does the package get installed under 2.6 like you want? My guess is that the shell that
sudo
runs might have 2.7 as its default, regardless of which Python your normal shell wants to use. What happens if you say: