简体   繁体   English

有没有办法解决为什么我不能 pip install 任何超过 2.7 的 python 模块?

[英]Is there a solution to why I can't pip install any python modules past 2.7?

I can't install any python modules that require python 2.7 or later.我无法安装任何需要 python 2.7 或更高版本的 python 模块。 I have uninstalled everything that Mac would let me that was related to python 2, and I run everything on python 3. I am completely lost.我已经卸载了 Mac 允许我使用的与 python 2 相关的所有内容,并且我在 python 3 上运行了所有内容。我完全迷失了。 I am on Mac and whenever I try to install a module(like praw) this pops up.我在 Mac 上,每当我尝试安装模块(如 praw)时,都会弹出这个。

I used the command我使用了命令

pip install praw
Collecting praw
  Using cached https://files.pythonhosted.org/packages/41/89/94c1ec81a05536e2c2a1dc2e8f5402c8ad65963f28948bf41c64621e238b/praw-6.5.0-py2-none-any.whl
ERROR: Package 'praw' requires a different Python: 2.7.16 not in '>=3.5' ```

Looks like the most recent version of praw requires Python 3.5 or greater.看起来最新版本的praw需要 Python 3.5 或更高版本。

The last version that supported Python 2.7 was praw 5.4.0 .支持 Python 2.7 的最后一个版本是praw 5.4.0 If you're still using Python 2.7 and need this package, try running如果您仍在使用 Python 2.7 并需要此包,请尝试运行

pip install praw==5.4.0

If you're using Python 3.x, check to see if you're using the right version of pip .如果您使用的是 Python 3.x,请检查您是否使用了正确版本的pip If you have both Python 2 and Python 3 installed on your system, you'll likely need to install system wide packages using pip3 instead if pip .如果您的系统上同时安装了 Python 2 和 Python 3,您可能需要使用pip3安装系统范围的软件包,如果pip In this case, try running在这种情况下,请尝试运行

pip3 install praw

Alternatively, if you're targeting a specific Python interpreter (eg python3.7 , python3.8 , etc), and want to be certain that you are using the correct pip executable for your interpreter, you can run pip as a Python package via或者,如果您的目标是特定的 Python 解释器(例如python3.7python3.8等),并且想要确定您为解释器使用了正确的pip可执行文件,则可以通过以下方式将 pip 作为 Python 包运行

python3 -m pip <args> 

where python3 can be replaced by any interpreter path.其中python3可以被任何解释器路径替换。

Welcome to Stack Overflow Malachi!欢迎来到 Stack Overflow Malachi! I believe you're looking for the command pip3 ( pip3 install praw ) to install Python 3 packages through pip.我相信您正在寻找命令pip3 ( pip3 install praw ) 来通过 pip 安装 Python 3 包。 If you open your terminal and type man pip to get the manual page, there is a line that says:如果您打开终端并输入man pip以获取手册页,则会有一行显示:

pip is the command to use when installing packages for Python 2, while pip3 is the command to use when installing packages for Python 3. pip 是为 Python 2 安装包时使用的命令,而 pip3 是为 Python 3 安装包时使用的命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM