我有两条令人感兴趣的python 2.7:
我用MacOS。(我知道我早就该改用Python 3了)
我想将pip install --upgrade PackageName应用于空闲的Python使用的包,但是当我在终端中输入它时,它会尝试将它应用到我的anaconda版本中。
有什么方法可以找到我空闲的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的
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)我关闭空闲,然后重新打开,然后键入
import skyfield
skyfield.__version__但还是只有1.0
没有最新消息。
Skyfield目前正在使用1.10 https://rhodesmill.org/skyfield/installation.html版本,我今天成功地将我的anaconda版本升级为使用pip install --upgrade skyfield的1.10。
发布于 2019-02-21 03:52:18
要找到您的空闲版本,请打开IDLE,打开菜单中的help部分。点击About IDLE,这就是您的python版本!
要验证您的pip是否是您想要的版本,只需输入以下内容:
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若要使用您希望使用的pip,请键入以下内容:
/usr/local/bin/pip install foo发布于 2019-02-21 16:20:21
在空闲shell中,输入import sys; sys.executable,您将看到执行空闲的python的完整路径。
若要安装到该特定可执行文件,请输入终端path/to/python.exe -m pip install ...。
https://stackoverflow.com/questions/54798448
复制相似问题