V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
puyaraimondii
V2EX  ›  Python

关于 pip 默认指向的 Python 版本

  •  
  •   puyaraimondii · 2017-03-09 17:02:22 +08:00 · 2569 次点击
    这是一个创建于 2611 天前的主题,其中的信息可能已经有所发展或是发生改变。
    想在 python2.7 中安装一个 tensorflow 的包,然而发现最近输入 pip ,会直接把这个包安装到 python3 中

    请问如何把 pip 默认的 python 版本改到 python2.7 里面啊?

    小白求助
    6 条回复    2017-03-10 09:54:40 +08:00
    Patrick95
        1
    Patrick95  
       2017-03-09 17:15:04 +08:00
    Python 2.7 -> pip2 install
    Python 3 -> pip3 install
    knightdf
        2
    knightdf  
       2017-03-09 17:36:28 +08:00
    vim `which pip` -> 修改第一行指向的 python
    puyaraimondii
        3
    puyaraimondii  
    OP
       2017-03-09 17:38:31 +08:00
    @knightdf 忘记说了,我用的不是 vim ,是直接在 terminal 上运行的。。。
    puyaraimondii
        4
    puyaraimondii  
    OP
       2017-03-09 17:42:40 +08:00
    @Patrick95 @knightdf 感谢两位的帮助,不知为何现在又恢复正常了。。。解决方案:把 terminal 关掉,再打开,重复两次就又恢复回去了。。。。感觉这个问题可能和我尝试了一下 sudo easy_install -U pip 有关。。。虽然还是不懂为什么。。。。
    ynyounuo
        5
    ynyounuo  
       2017-03-09 17:47:06 +08:00
    @puyaraimondii ... 你大概没理解意思
    pip 本身就是个 python script 然后给了 x 权限而已
    ox0spy
        6
    ox0spy  
       2017-03-10 09:54:40 +08:00
    $ pip -V # 看看使用的 pip 对不对

    $ pip show <installed-package> # 看看 Location 字段的值
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2238 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:32 · PVG 17:32 · LAX 02:32 · JFK 05:32
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.