pycharm 如何在M1 Mac上安装Pandas

kuarbcqp  于 2022-11-08  发布在  PyCharm
关注(0)|答案(7)|浏览(491)
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs/src/ujson/python -Ipandas/_libs/src/ujson/lib -Ipandas/_libs/src/datetime -I/Users/jesse/Desktop/ssc/pythonProject3/venv/lib/python3.8/site-packages/numpy/core/include -I/Users/jesse/Desktop/ssc/pythonProject3/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c pandas/_libs/src/ujson/python/ujson.c -o build/temp.macosx-10.14.6-arm64-3.8/pandas/_libs/src/ujson/python/ujson.o -D_GNU_SOURCE -Wno-unused-function
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs/src/ujson/python -Ipandas/_libs/src/ujson/lib -Ipandas/_libs/src/datetime -I/Users/jesse/Desktop/ssc/pythonProject3/venv/lib/python3.8/site-packages/numpy/core/include -I/Users/jesse/Desktop/ssc/pythonProject3/venv/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c pandas/_libs/src/ujson/python/objToJSON.c -o build/temp.macosx-10.14.6-arm64-3.8/pandas/_libs/src/ujson/python/objToJSON.o -D_GNU_SOURCE -Wno-unused-function
    pandas/_libs/src/ujson/python/objToJSON.c:181:12: error: use of undeclared identifier 'NUMPY_IMPORT_ARRAY_RETVAL'
        return NUMPY_IMPORT_ARRAY_RETVAL;
               ^
    1 error generated.
    error: command 'clang' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/jesse/Desktop/ssc/pythonProject3/venv/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/ky/s4qqls154f9c4j5lfcfspbpm0000gn/T/pip-install-t5zlzk09/pandas_67e63708ec954c589e697c9f10e3730c/setup.py'"'"'; __file__='"'"'/private/var/folders/ky/s4qqls154f9c4j5lfcfspbpm0000gn/T/pip-install-t5zlzk09/pandas_67e63708ec954c589e697c9f10e3730c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/ky/s4qqls154f9c4j5lfcfspbpm0000gn/T/pip-record-cnus0d48/install-record.txt --single-version-externally-managed --compile --install-headers /Users/jesse/Desktop/ssc/pythonProject3/venv/include/site/python3.8/pandas Check the logs for full command output.
(base)

我想使用PyCharm在Mac mini上下载Pandas。
我该怎么办?

wgeznvg7

wgeznvg71#

此问题的回答时间为:
Trouble installing Pandas on new MacBook Air M1

python3 -m pip install virtualenv
virtualenv -p python3.8 venv
source venv/bin/activate
pip install --upgrade pip
pip install numpy cython
git clone https://github.com/pandas-dev/pandas.git
cd pandas
python3 setup.py install
o7jaxewo

o7jaxewo2#

您必须在环境中安装numpy,才能从来源建置pandas,以供所有不含pyproject.tomlpandas版本使用。请先安装numpy,然后再试一次。
如果您的计算机上安装了numpy,则可能需要使用pip install numpy -U或通过PyCharm GUI执行的等效命令来更新版本。

hmae6n7t

hmae6n7t3#

虽然caeneb的技巧非常有效,但我发现将你的python升级到更高版本和更新pip也很有效。
对我来说,这些命令起到了作用(我使用pyenv管理Python安装)

pyenv install 3.9.9
pyenv global 3.9.9 # use this python version as the default
pip install pandas # just works

我想,如果没有pyenv,您可以简单地运行以下命令(未经测试)

brew install python@3.9.9
$(brew --prefix)/bin/python3.9 -m pip install pandas # makes sure to use the right pip
byqmnocz

byqmnocz4#

我建议你使用conda,这样你就可以安装虚拟环境,也可以使用不同的python版本,最终使用不同的R(以及node.js)。
另外,你确定你已经安装了xcode吗?在苹果商店检查。Xcode是苹果的“SDK”(开发者工具包)与编译器:clang:你没有它,所以错误。它也给你其他的工具,通常需要pip。注意:您还应该手动执行一个xcode命令,以便能够接受xcode条件(否则您可能会在使用xcode的脚本上遇到问题)。

hxzsmxv2

hxzsmxv25#

这对我很有效pip install git+git://github.com/pandas-dev/pandas.git

xe55xuns

xe55xuns6#

从手动查看numpy git日志,使用pip install numpy==1.18.5降级numpy,然后
OPENBLAS="$(brew --prefix openblas)" MACOSX_DEPLOYMENT_TARGET=12.4 pip3 install pandas==0.25.3 --no-use-pep517
安装Pandas后,我能够再次升级numpy

pbwdgjma

pbwdgjma7#

一个月一次
在Mac中安装pip:
$curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

  • 安装带有自制程序的python:

brew install python

  • 确保路径正确:

$which python

  • 现在安装Pandas:

$pip install pandas

相关问题