繁体   English   中英

用python和python3安装pandas的区别

[英]Difference between installing pandas with python and python3

我必须安装熊猫,但我正在尝试的任何东西似乎都不起作用。 我试图在 cmd 中运行它

pip install wheel
pip install pandas
pip3 install pandas
python -m pip install pandas
python3 -m pip install pandas

甚至更新了设置工具。 当我运行python -m pip install pandas ,它告诉我满足要求

Requirement already satisfied: pandas in c:\users\UserName\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (1.1.3)

但是,当我将其更改为python3 -m pip install pandas ,我收到了这个标题非常长的错误, ERROR: Command errored out with exit status 1:

所以我有2个问题。 1,我使用pythonpython3什么区别。 2、有没有更可靠的方法可以安装pandas?

这些是我运行安装时的一些错误消息

ERROR: Command errored out with exit status 1:
   command: 'c:\users\UserName\appdata\local\programs\python\python39\python.exe' 'c:\users\UserName\appdata\local\programs\python\python39\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\UserName\AppData\Local\Temp\pip-build-env-a85382ti\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.15.4; python_version=='"'"'3.6'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.15.4; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.6'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.16.0; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"''
       cwd: None

然后它告诉我我缺少所有这些模块但我不知道如何安装它们

    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in c:\users\UserName\appdata\local\programs\python\python39\lib
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries ptf77blas,ptcblas,atlas not found in c:\users\UserName\appdata\local\programs\python\python39\lib
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in C:\
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries ptf77blas,ptcblas,atlas not found in C:\
    No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
    customize MSVCCompiler
      libraries lapack_atlas not found in c:\users\UserName\appdata\local\programs\python\python39\libs

假设您使用的是 Linux 或 Mac, python代表Python 版本 2,python3当然代表Python 版本 3 你不应该使用 python 2,因为它不再被积极开发,而且它的支持也在一年多前被放弃了。 长话短说使用python 3。

对于您的第二个问题,只需在终端中运行pip3 install pandas即可。

python是 Python 2 的旧版本,目前存在python 3

我们可以说python 2现在已经过时了

大多数库在使用 python2 或 python3 时可能会出错。 这意味着可能有一些不兼容的库可能支持 python2,反之亦然。

在 Python 3 中,文本字符串默认为 Unicode。 在 Python 2 中,字符串默认存储为 ASCII——如果您想在 Python 2.x 中将字符串存储为 Unicode,则必须添加“u”。

此外,打印语句现在替换为打印功能。

pip3 install pandas您的问题,您可以做的是从系统中删除 python 2 并运行pip3 install pandas

此外,如果你面临的困难进一步,你可以尝试用工作一些虚拟的环境是这样

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM