【问题标题】:Installing pip in different versions of python在不同版本的python中安装pip
【发布时间】:2014-09-05 16:31:15
【问题描述】:

我安装了多个版本的 Python (2.5,2.7)。我正在使用 Ubuntu。 Python2.7 是我默认的 Python 解释器。所以所有像PIL这样的包都安装在python2.7中。现在我想在 Python 2.5 版本中安装一些包。 我需要安装 Pip 以便我可以安装软件包。现在我明白有些人会给出 virtualenv 的建议。我也试过了。 但是通过它安装 Pil 也不会显示 python2.5 版本中的包。它安装在python2.7版本中。所以我需要做一些事情,以便当 pip 安装包时,它会在 Python2.5 版本中安装它。有什么建议吗?

我也试过这个:

python2   -m pip install SomePackage  # default Python 2
python2.5 -m pip install SomePackage  # specifically Python 2.5

但它说没有名为 pip 的模块

【问题讨论】:

    标签: python-2.7 pip virtualenv python-2.5


    【解决方案1】:

    根据这个答案:pip: dealing with multiple Python versions?

    如果 pip >= 1.5,你必须这样尝试:

    $ pip2.5 install SomePackage 
    $ pip2.7 install SomePackage 
    

    其他:

    $ pip-2.5 install SomePackage  
    $ pip-2.7 install SomePackage  
    

    【讨论】:

    • 我试过了。它有效,但我无法让包正常工作。我想安装 PIL 或 Pillow。
    • _imagingft C 模块未安装。我能够找到 Windows 的非官方库,它包含正确的包,但对于 ubunutu,没有。
    • 你安装了吗apt-get install libjpeg-devapt-get install libfreetype6-devapt-get install zlib1g-devapt-get install libpng12-dev???
    • 我做了,但我猜它们是为默认的 python 版本安装的。我需要它为 2.5 工作。上面所有的包都安装好了。
    • 这是一个聪明的建议,但 .egg 文件中的某个位置会包含可能导致错误的窗口。虽然我一定会试一试。感谢您的耐心、时间和帮助。
    猜你喜欢
    • 1970-01-01
    • 2020-05-01
    • 1970-01-01
    • 2012-08-01
    • 1970-01-01
    • 2015-09-01
    • 1970-01-01
    • 2016-06-30
    • 1970-01-01
    相关资源
    最近更新 更多