问题描述
尝试安装:
pip install multiprocessing
出现错误:
Collecting multiprocessing
Using cached multiprocessing-2.6.2.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/7s/sswmssj51p73hky4mkqs4_zc0000gn/T/pip-build-8c0dk6ai/multiprocessing/setup.py", line 94
print 'Macros:'
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/7s/sswmssj51p73hky4mkqs4_zc0000gn/T/pip-build-8c0dk6ai/multiprocessing/
有人知道解决这个问题的方法吗?
Anyone knows the way to fix this?
推荐答案
简而言之:python 3中已经预装了Multiprocessing,无需安装.
我找到了我的问题的答案,这是一个愚蠢的答案 - 默认情况下,多处理已预安装在我的 Python 版本 (3.5.2) 中.
I found an answer to my question and it's a silly one - multiprocessing is already pre-installed in my version of Python (3.5.2) by default.
它不会出现在 Anaconda >> Environments >> root 的软件包列表中,因为它不是第三方软件包而是内部软件包.
It won't show up in the list of packages in Anaconda >> Environments >> root, as it's not a third party package but an internal one.
如果有人不确定这是否适用于您,只需在 Python 控制台中检查 from multiprocessing import Pool
.
If anyone is not sure whether this applies to you, just check from multiprocessing import Pool
in your Python console.
这适用于所有当前支持的 Python 版本(2.7 和 3.x),并且根据 Python 维护者/贡献者的说法 multiprocessing
自 Python 2.6 以来一直是标准库(包括电池)的一部分.https://bugs.python.org/msg326646
This is true of all currently supported versions of Python (2.7 and 3.x) and according to a Python maintainer/contributor multiprocessing
has been part of the standard library (batteries included) since Python 2.6. https://bugs.python.org/msg326646
您不再需要执行 pip install multiprocessing
并且不要将它包含在您的 requirements.txt
中,除非您正在维护一个 Python 2.4/2.5 应用程序(请迁移!).在大多数版本上,您只需 import multiprocessing
就可以了.
You won't need to do a pip install multiprocessing
anymore and do NOT include it in your requirements.txt
unless you are maintaining a Python 2.4/2.5 application (please migrate!). On most versions you can just import multiprocessing
and you should be fine.
这篇关于Python 多处理安装:命令“python setup.py egg_info";失败,错误代码 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!