尝试在macOS上使用pip安装任何内容,但无法 [英] Trying to install anything with pip on macos and cannot

查看:299
本文介绍了尝试在macOS上使用pip安装任何内容,但无法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为我的mac os系统有问题.我尝试使用pip安装在它上面的所有东西,我一遍又一遍地得到相同的错误,我只粘贴了显示错误的行,以确保该线程不会过度拥挤:

I think I have a problem with my mac os system. Everything I try to install on it using pip I get the same errors over and over again, I have pasted just the lines that display an error to not overcrowd this thread:

Collecting murmurhash3
  Using cached https://files.pythonhosted.org/packages/b5/f4/1f9c4851667a2541bd151b8d9efef707495816274fada365fa6a31085a32/murmurhash3-2.3.5.tar.gz
Building wheels for collected packages: murmurhash3
  Running setup.py bdist_wheel for murmurhash3 ... error
  Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/15/_mc1281d6kn_z8my6cz6dj740000gq/T/pip-install-_4hr8w03/murmurhash3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/15/_mc1281d6kn_z8my6cz6dj740000gq/T/pip-wheel-k28wu_2e --python-tag cp37:
  running bdist_wheel
  running build
  running build_ext
  building 'mmh3' extension
  creating build
  creating build/temp.macosx-10.14-x86_64-3.7
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include -I/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c mmh3module.cpp -o build/temp.macosx-10.14-x86_64-3.7/mmh3module.o
  In file included from mmh3module.cpp:3:
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:14:2: error: "Something's broken.  UCHAR_MAX should be defined in limits.h."
  #error "Something's broken.  UCHAR_MAX should be defined in limits.h."
   ^
  /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:18:2: error: "Python's source code assumes C's unsigned char is an 8-bit type."
  #error "Python's source code assumes C's unsigned char is an 8-bit type."
   ^
  mmh3module.cpp:99:5: error: use of undeclared identifier 'memcpy'; did you mean 'wmemcpy'?
      memcpy(bytes, result, 16);
      ^~~~~~
      wmemcpy
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/wchar.h:152:10: note: 'wmemcpy' declared here
  wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
           ^
  mmh3module.cpp:99:12: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [16]'
      memcpy(bytes, result, 16);
             ^~~~~
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/wchar.h:152:38: note: passing argument to parameter here
  wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
                                       ^
  4 errors generated.
  error: command 'clang' failed with exit status 1

  ----------------------------------------
  Failed building wheel for murmurhash3
  Running setup.py clean for murmurhash3
Failed to build murmurhash3
Installing collected packages: murmurhash3
  Running setup.py install for murmurhash3 ... error
    Complete output from command /usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/15/_mc1281d6kn_z8my6cz6dj740000gq/T/pip-install-_4hr8w03/murmurhash3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/15/_mc1281d6kn_z8my6cz6dj740000gq/T/pip-record-7a15nstl/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'mmh3' extension
    creating build
    creating build/temp.macosx-10.14-x86_64-3.7
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include -I/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c mmh3module.cpp -o build/temp.macosx-10.14-x86_64-3.7/mmh3module.o
    In file included from mmh3module.cpp:3:
    /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:14:2: error: "Something's broken.  UCHAR_MAX should be defined in limits.h."
    #error "Something's broken.  UCHAR_MAX should be defined in limits.h."
     ^
    /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/include/python3.7m/Python.h:18:2: error: "Python's source code assumes C's unsigned char is an 8-bit type."
    #error "Python's source code assumes C's unsigned char is an 8-bit type."
     ^
    mmh3module.cpp:99:5: error: use of undeclared identifier 'memcpy'; did you mean 'wmemcpy'?
        memcpy(bytes, result, 16);
        ^~~~~~
        wmemcpy
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/wchar.h:152:10: note: 'wmemcpy' declared here
    wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
             ^
    mmh3module.cpp:99:12: error: cannot initialize a parameter of type 'wchar_t *' with an lvalue of type 'char [16]'
        memcpy(bytes, result, 16);
               ^~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/wchar.h:152:38: note: passing argument to parameter here
    wchar_t *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
                                         ^
    4 errors generated.
    error: command 'clang' failed with exit status 1

    ----------------------------------------
Command "/usr/local/opt/python/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/15/_mc1281d6kn_z8my6cz6dj740000gq/T/pip-install-_4hr8w03/murmurhash3/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/15/_mc1281d6kn_z8my6cz6dj740000gq/T/pip-record-7a15nstl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/15/_mc1281d6kn_z8my6cz6dj740000gq/T/pip-install-_4hr8w03/murmurhash3/

另一方面,当我尝试安装lxmlrequests时,一切正常.对我搞砸的地方有什么想法吗?

On the other hand when I try to install lxml or requests everything works great. Any thoughts on where I have messed up?

推荐答案

murmurhash3 >是针对Python> 3.2的,最初您尝试针对Python 2进行编译.由于该库具有C扩展名,并且Python 2和3与API不兼容,因此该代码不起作用.

The library murmurhash3 is meant for Python >3.2 and at first you were attempting to compile it for Python 2. It doesn't work as the library has a C extension and Python 2 and 3 are not mutually API compatible.

当然会更容易注意到,如果murmurhash3setup.py中检查了您的Python版本.

Of course it would have been easier to notice, would murmurhash3 have checked your Python version in its setup.py.

现在您要尝试将其安装到Python 3,很明显,编译器出了点问题! C标准要求UCHAR_MAX是由存在的每个单个C编译器在<limits.h>中定义的,在任何当前的个人计算体系结构上,UCHAR_MAX都应定义为255,包括Mac. Python.h 进行检查.您的C编译器既未定义UCHAR_MAX,也未在limits.h中将其设置为255,但仍成功包含 some limits.h.您的C编译器完全崩溃了

Now that you're trying to install it to Python 3, it is clear that there is something very wrong with your compiler! The C standard requires that UCHAR_MAX is defined in <limits.h> by every single C compiler in existence and on any current personal computing architecture the UCHAR_MAX should be defined to 255, Macs included. Python.h checks this. Your C compiler defined neither UCHAR_MAX nor did it set it to 255 in limits.h but it still successfully included some limits.h. Your C compiler is utterly b0rken

这篇关于尝试在macOS上使用pip安装任何内容,但无法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆