我有两个感兴趣的python 2.7:
我使用MacOS。 (我知道我该改用Python 3了。)
我想将pip install --upgrade PackageName
应用于IDLE的Python使用的软件包,但是当我在终端中键入该软件包时,它将尝试将其应用于我的anaconda版本。
有没有办法找到我的IDLE的python,指向它,然后对其应用pip
命令?
这就是我所拥有的:
$ 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
更新:每this answer,我打开IDLE并输入
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
我收到了以下信息:
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,然后重新打开它,然后键入
import skyfield
skyfield.__version__
仍然只有1.0
没有更新。
Skyfield当前的版本为1.10
https://rhodesmill.org/skyfield/installation.html,我今天使用1.10
将anaconda版本成功升级到了pip install --upgrade skyfield
答案 0 :(得分:1)
要找到您的IDLE版本,请打开IDLE
,然后转到菜单栏中的help
部分。点击About IDLE
,就有您的python版本!
要验证您的点子是否是您想要的版本,只需输入以下内容即可:
pip -V
它将在Windows上为您提供类似的信息(MAC将类似):
pip 19.0.2 from c:\python27\lib\site-packages\pip (python 2.7)
在错误路径的情况下,只需获取get-pip.py
,然后使用要编译的python版本运行它即可:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
要使用您想使用的点子,请输入以下内容:
/usr/local/bin/pip install foo
答案 1 :(得分:1)
在IDLE外壳程序中,输入import sys; sys.executable
,您将看到执行IDLE的python的完整路径。
要安装到该特定的可执行文件,请在终端path/to/python.exe -m pip install ...
中输入。