1

I'm new with python. Recently, I want to install numpy on my macOS. I have installed brew, python and pip already. Also, I have aliased pip pip3 and python to python3. However, when I run pip install numpy it shows me an error.

I'm also confused about I'm expected to use pip3 for installing numpybecause of the alias. But why the warning is about python2.7?

➜  ~ which python
python: aliased to /usr/local/bin/python3.6
➜  ~ which pip
pip: aliased to /usr/local/bin/pip3
➜  ~ pip install numpy
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (1.8.0rc1)
clemens
  • 14,173
  • 11
  • 38
  • 52
Yi-An
  • 63
  • 5

1 Answers1

0

It is difficult to find the exact cause of the error if you do not have access to the computer. It seems that despite the aliases you use Python 2 but Python 3 cannot use the modules of Python 2.

You can use pip as a module to force the Python version, e. g.:

python3 -mpip install numpy

or

/usr/local/bin/python3.6 -mpip install numpy
clemens
  • 14,173
  • 11
  • 38
  • 52
  • Hi there, thanks for answering. However, when I try those two lines, I also got error :( – Yi-An May 21 '20 at 13:41
  • pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping – Yi-An May 21 '20 at 13:41
  • Probably the SSL libraries are missing on your Mac. Apple replaced OpenSSL with Crypto some time ago. But you can install OpenSSL via brew. – clemens May 21 '20 at 13:47
  • I have tried "brew uninstall openssl; brew install openssl" or "brew reinstall openssl" but I still get error, did I just do something wrong? BTW, thanks – Yi-An May 21 '20 at 13:49
  • https://stackoverflow.com/questions/45954528/pip-is-configured-with-locations-that-require-tls-ssl-however-the-ssl-module-in/57240184 This works! – Yi-An May 21 '20 at 15:15