首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试安装PyCrypto时出错

尝试安装PyCrypto时出错
EN

Stack Overflow用户
提问于 2016-09-19 16:00:00
回答 1查看 2.1K关注 0票数 1

我使用的是Mac和最新的OS X更新。我试图在终端上安装PyCrypto,但我得到了错误,如下图所示。我使用的命令是sudo pip install pycrypto。你能帮我解决这个问题吗?我该如何解决这个问题?谢谢你的回答。

下面是错误:

代码语言:javascript
复制
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/

错误太大了,不能全部复制。所以我只复制了开头和结尾。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-09-19 19:04:30

您需要安装Python开发文件。我想它会起作用的。试一试

代码语言:javascript
复制
apt-get install autoconf g++ python2.7-dev 

代码语言:javascript
复制
sudo apt-get install python-dev

上面的任何一个,然后下面的这个

代码语言:javascript
复制
pip install pycrypto
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39568110

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档