簡體   English   中英

嘗試安裝 PyCrypto 時出錯

[英]Error when trying to install PyCrypto

我正在使用帶有最新 OS X 更新的 Mac。 我試圖通過終端安裝 PyCrypto,但出現錯誤,如下圖所示。 我使用的命令是sudo pip install pycrypto 你能幫我解決這個問題嗎? 我該如何解決? 感謝您的回答。

在此處輸入圖片說明

這是錯誤:

macfive:Desktop admin$ sudo pip install pycrypto
The directory '/Users/admin/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/admin/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pycrypto
  Downloading pycrypto-2.6.1.tar.gz (446kB)
    100% |████████████████████████████████| 450kB 2.4MB/s 
Installing collected packages: pycrypto
  Running setup.py install for pycrypto ... error
    Complete output from command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-CYttJL/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-mWAGUD-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py

.
.
.

src/hash_template.c:291: warning: return from incompatible pointer type
    src/hash_template.c: At top level:
    src/hash_template.c:306: error: initializer element is not constant
    src/hash_template.c:306: error: (near initialization for ‘ALG_functions[1].ml_name’)
    src/hash_template.c:306: error: initializer element is not constant
    src/hash_template.c:306: error: (near initialization for ‘ALG_functions[1].ml_meth’)
    fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can't figure out the architecture type of: /var/tmp//ccCeO0Zf.out
    error: command 'gcc-4.2' failed with exit status 1

    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-CYttJL/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-mWAGUD-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-CYttJL/pycrypto/

錯誤太大,無法全部復制。 所以我只是復制了開頭和結尾。

您需要安裝 Python 開發文件。 我認為它會起作用。 嘗試

apt-get install autoconf g++ python2.7-dev 

或者

sudo apt-get install python-dev

上面的任何一個,然后這個下面的一個

pip install pycrypto

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM