gpt4 book ai didi

python - Pandas:当我尝试使用 pip 安装它时出错

转载 作者:行者123 更新时间:2023-11-28 18:15:02 24 4
gpt4 key购买 nike

我尝试使用 pip 安装 pandas,但出现了几个警告和一个错误。

这是我使用的命令

pip install pandas

我收到过几条这样的警告信息:

x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/pandas/_libs/join.o -o build/lib.linux-x86_64-2.7/pandas/_libs/join.so

building 'pandas._libs.tslibs.frequencies' extension

creating build/temp.linux-x86_64-2.7/pandas/_libs/tslibs

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Ipandas/_libs/src/klib -Ipandas/_libs/src -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c pandas/_libs/tslibs/frequencies.c -o build/temp.linux-x86_64-2.7/pandas/_libs/tslibs/frequencies.o -Wno-unused-function

In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1816:0,

from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,

from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,

from pandas/_libs/tslibs/frequencies.c:526:

/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

#warning "Using deprecated NumPy API, disable it by " \

当最终出现错误消息时

  Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_flaviomb-lasse/pandas/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-O3U0h8-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_flaviomb-lasse/pandas
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main
return command.main(cmd_args)
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 37: ordinal not in range(128)`

我的python版本是Python 2.7.6,我的ubuntu版本是16.04

错误的原因是什么?

最佳答案

我无法重现您的错误。我使用 docker 来运行一个容器来模拟你的问题。更具体地说,我运行了 docker run -it --rm ubuntu:16.04 bash 并在容器内:

1  apt-get update
2 apt-get install wget
3 wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
4 ls
5 tar xzf Python-2.7.6.tgz
6 ls
7 cd Python-2.7.6
8 ls
9 ./configure
10 apt-get install build-essential checkinstall
11 apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
12 ./configure
13 python
14 make
15 make install
16 python
17 pip
18 curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
19 apt-get install curl
20 curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
21 ls
22 python get-pip.py
23 pip
24 pip install pandas
25 history

Pandas 安装成功:

root@aa206d4f31c6:/Python-2.7.6# pip install pandas
Collecting pandas
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https:// urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Downloading pandas-0.22.0.tar.gz (11.3MB)
100% |################################| 11.3MB 151kB/s
Collecting python-dateutil (from pandas)
Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
100% |################################| 194kB 6.4MB/s
Collecting pytz>=2011k (from pandas)
Downloading pytz-2018.3-py2.py3-none-any.whl (509kB)
100% |################################| 512kB 3.0MB/s
Collecting numpy>=1.9.0 (from pandas)
Downloading numpy-1.14.0-cp27-cp27m-manylinux1_x86_64.whl (16.9MB)
100% |################################| 16.9MB 101kB/s
Collecting six>=1.5 (from python-dateutil->pandas)
Downloading six-1.11.0-py2.py3-none-any.whl
Building wheels for collected packages: pandas
Running setup.py bdist_wheel for pandas ... done
Stored in directory: /root/.cache/pip/wheels/e8/ed/46/0596b51014f3cc49259e52dff9824e1c6fe352048a2656fc92
Successfully built pandas
Installing collected packages: six, python-dateutil, pytz, numpy, pandas
Successfully installed numpy-1.14.0 pandas-0.22.0 python-dateutil-2.6.1 pytz-2018.3 six-1.11.0

所以您可能以不同的方式安装了系统依赖项(例如 gcc)、python 或 pip。我关注了https://askubuntu.com/questions/443048/python-2-7-6-on-ubuntu-12-04-how-to .你是如何安装你的东西的?

关于python - Pandas:当我尝试使用 pip 安装它时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48869196/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com