![](/img/trans.png)
[英]Pip Installation Error - Command python setup.py egg_info failed with error code 1
[英]Python multiprocessing installation: Command "python setup.py egg_info" failed with error code 1
嘗試安裝:
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/
有誰知道解決這個問題的方法?
簡而言之:多處理已經預裝在 python 3 中,無需安裝。
我找到了我的問題的答案,這是一個愚蠢的答案 - 默認情況下,我的 Python 版本(3.5.2)中已經預安裝了多處理。
它不會出現在 Anaconda >> Environments >> root 中的軟件包列表中,因為它不是第三方軟件包而是內部軟件包。
如果有人不確定這是否適用於您,只需檢查 Python 控制台中的from multiprocessing import Pool
即可。
這適用於所有當前支持的 Python 版本(2.7 和 3.x),並且根據 Python 維護者/貢獻者的說法,自 Python 2.6 以來, multiprocessing
已成為標准庫(包括電池)的一部分。 https://bugs.python.org/msg326646
除非您正在維護 Python 2.4/2.5 應用程序(請遷移!),否則您將不再需要執行pip install multiprocessing
並且不要將其包含在您的requirements.txt
中。 在大多數版本上,您可以只import multiprocessing
,您應該沒問題。
而不是pip install multiprocessing
類型:
pip install multiprocess
當然,您正在嘗試在 python3 上安裝多處理庫,而該庫默認安裝在 python3 上並且不需要再次安裝。 走運
如果執行 IPython Notebook 時multiprocessing
模塊出現問題,也許只是嘗試重新啟動內核。 它曾經發生在我身上。
pip3.5 安裝多處理工具
python -m pip install multiprocessing
使用python2.7安裝多處理而不是使用python3.5+
Python 2.7 到 3 從print "Hello World"
更改為print('Hello World')
使 print 現在成為一個函數。 從錯誤消息來看,看起來pip
或multiprocessing
正在期待 python 3。
您可以使用以下命令檢查您的 Python 版本:
python --version
如果你已經在 linux 上安裝了 python 3,你可以更新 pip:
sudo apt-get install python3-pip
對於 mac,您可以使用等效的 homebrew 命令。 這應該允許您使用:
pip3 install multiprocessing
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.