问题描述
我有两个感兴趣的python 2.7:
I have two python 2.7's of interest:
- 具有IDLE的版本,该版本来自 https://www.python.org/downloads/
- anaconda 2.7安装
我使用MacOS. (我知道我该改用Python 3了.)
I use MacOS. (I understand I'm overdue to switch to Python 3)
我想将pip install --upgrade PackageName
应用于IDLE的Python使用的软件包,但是当我在终端中键入该代码时,它将尝试将其应用于我的anaconda版本.
I'd like to apply pip install --upgrade PackageName
to a package that IDLE's Python uses, but when I type that in my terminal it tries to apply it to my anaconda version.
有没有办法找到我的IDLE的python,指向它,然后对它应用pip
命令?
Is there a way I can find my IDLE's python, point to it, then apply the pip
command to it?
这就是我所拥有的:
$ which python
/Users/david/anaconda2/bin/python
$ which -a python
/Users/david/anaconda2/bin/python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/local/bin/python
/usr/bin/python
更新:每个此答案我打开了IDLE,然后输入了
update: Per this answer I've opened IDLE and typed
import sys
sys.executable
,它返回/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
.
然后我打开一个终端并输入/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -m pip install --upgrade skyfield
I then opened a terminal and entered /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -m pip install --upgrade skyfield
我收到了以下信息:
Cache entry deserialization failed, entry ignored
Could not fetch URL https://pypi.python.org/simple/skyfield/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Requirement already up-to-date: skyfield in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Could not fetch URL https://pypi.python.org/simple/jplephem/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Requirement already up-to-date: jplephem>=2.3 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from skyfield)
Could not fetch URL https://pypi.python.org/simple/sgp4/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Requirement already up-to-date: sgp4>=1.4 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from skyfield)
Could not fetch URL https://pypi.python.org/simple/numpy/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Requirement already up-to-date: numpy in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from skyfield)
我关闭IDLE,然后重新打开它,然后键入
I close IDLE then reopen it, then type
import skyfield
skyfield.__version__
但仍然只有1.0
没有更新.
Skyfield当前为版本1.10
https://rhodesmill.org/skyfield/installation.html ,我今天使用pip install --upgrade skyfield
Skyfield is currently on version 1.10
https://rhodesmill.org/skyfield/installation.html and I upgraded my anaconda version successfully today to 1.10
using pip install --upgrade skyfield
推荐答案
在IDLE shell中,输入import sys; sys.executable
,您将看到执行IDLE的python的完整路径.
In the IDLE shell, enter import sys; sys.executable
and you will see full path to the python that is executing IDLE.
要安装到该特定可执行文件,请在终端path/to/python.exe -m pip install ...
中输入.
To install to that specific executable, enter in Terminal path/to/python.exe -m pip install ...
.
这篇关于如何找到我的IDLE的Python,然后将pip升级应用于它使用的软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!