简体   繁体   中英

problems installing pandas module with pip on mac

I have 2 python installations on my mac osx.

$ which python
/usr/bin/python

$ which python3
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3

$ pip install --upgrade setuptools
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/37/06/754589caf971b0d2d48f151c2586f62902d93dc908e2fd9b9b9f6aa3c9dd/setuptools-40.6.3-py2.py3-none-any.whl (573kB)
    100% |████████████████████████████████| 655kB 1.5MB/s 
Installing collected packages: setuptools
  Found existing installation: setuptools 2.1
    Uninstalling setuptools-2.1:
      Successfully uninstalled setuptools-2.1
Successfully installed setuptools-40.6.3
$ which pip
/Library/Frameworks/Python.framework/Versions/3.4/bin/pip

$ pip -V
pip 18.1 from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip (python 3.4)

I can install modules with pip fine. for example $ python3 -m pip install --user tensorflow Successfully installed absl-py-0.6.1 astor-0.7.1 gast-0.2.0 grpcio-1.17.1 markdown-3.0.1 protobuf-3.6.1 tensorboard-1.12.1 tensorflow-1.12.0 termcolor-1.1.0 werkzeug-0.14.1

but when i try the same with pandas $ python3 -m pip install --user pandas

it goes through till the end by collecting and downloading dependencies, but errors out with the following error.

Collecting pandas
  Downloading https://files.pythonhosted.org/packages/08/01/803834bc8a4e708aedebb133095a88a4dad9f45bbaf5ad777d2bea543c7e/pandas-0.22.0.tar.gz (11.3MB)
    100% |████████████████████████████████| 11.4MB 1.5MB/s 
  Installing build dependencies ... done
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.org/simple/numpy/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:600) -- Some packages may not be found!
    Couldn't find index page for 'numpy' (maybe misspelled?)
    Download error on https://pypi.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:600) -- Some packages may not be found!
    No local packages or working download links found for numpy>=1.9.0
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/d5/k1w6m6xj5g727x952sdkkc1r0000gn/T/pip-install-r4n38agj/pandas/setup.py", line 743, in <module>
        **setuptools_kwargs)
      File "/private/var/folders/d5/k1w6m6xj5g727x952sdkkc1r0000gn/T/pip-build-env-fqe1gkak/lib/python3.4/site-packages/setuptools/__init__.py", line 142, in setup
        _install_setup_requires(attrs)
      File "/private/var/folders/d5/k1w6m6xj5g727x952sdkkc1r0000gn/T/pip-build-env-fqe1gkak/lib/python3.4/site-packages/setuptools/__init__.py", line 137, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/private/var/folders/d5/k1w6m6xj5g727x952sdkkc1r0000gn/T/pip-build-env-fqe1gkak/lib/python3.4/site-packages/setuptools/dist.py", line 586, in fetch_build_eggs
        replace_conflicting=True,
      File "/private/var/folders/d5/k1w6m6xj5g727x952sdkkc1r0000gn/T/pip-build-env-fqe1gkak/lib/python3.4/site-packages/pkg_resources/__init__.py", line 780, in resolve
        replace_conflicting=replace_conflicting
      File "/private/var/folders/d5/k1w6m6xj5g727x952sdkkc1r0000gn/T/pip-build-env-fqe1gkak/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1063, in best_match
        return self.obtain(req, installer)
      File "/private/var/folders/d5/k1w6m6xj5g727x952sdkkc1r0000gn/T/pip-build-env-fqe1gkak/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1075, in obtain
        return installer(requirement)
      File "/private/var/folders/d5/k1w6m6xj5g727x952sdkkc1r0000gn/T/pip-build-env-fqe1gkak/lib/python3.4/site-packages/setuptools/dist.py", line 653, in fetch_build_egg
        return cmd.easy_install(req)
      File "/private/var/folders/d5/k1w6m6xj5g727x952sdkkc1r0000gn/T/pip-build-env-fqe1gkak/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 673, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('numpy>=1.9.0')

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/d5/k1w6m6xj5g727x952sdkkc1r0000gn/T/pip-install-r4n38agj/pandas/

The issue seems to be that it is using Python where it should be using python3 in python setup.py egg_info

how do i make sure that pip uses python3 in the scripts or if there is any other issues ?

You can use any code given below

pip3 install pandas --no-build-isolation

OR

sudo apt-get install python3-pip
sudo -H pip3 install pandas

OR

sudo pip install pandas

OR

pip install --user pandas

and for mac terminal using mojave works like

pip3 install pandas

or

pip 3 install --upgrade pip

after

pip install pandas

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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