0

I have to use Python3.4.1 for a software hence I installed it from the source code. Now after I installed pip using easy_install I get this error:

bash-4.3$ python
Python 3.4.1 (default, Aug  4 2016, 13:53:56)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
>>>

>>> sys.executable
'/usr/local/bin/python3'
>>> import pip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'pip'
    bash-4.3$ python3 -m pip install --user numpy
    /usr/local/bin/python3: Error while finding spec for 'pip.__main__' (<class 'ImportError'>: cannot import name 'HTTPSHandler'); 'pip' is a package and cannot be directly executed
bash-4.3$ python -m pip install --user numpy
/usr/local/bin/python3: Error while finding spec for 'pip.__main__' (<class 'ImportError'>: cannot import name 'HTTPSHandler'); 'pip' is a package and cannot be directly executed
bash-4.3$ pip -V
pip 8.1.2 from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (python 3.4)
bash-4.3$ python --version
Python 3.4.1

How can I get numpy installed for this version of Python in OSX EL Capitan?

bash-4.3$ pip freeze | grep numpy
numpy==1.11.1

UPDATE: I even tried this method however still can't import:

bash-4.3$ wget https://bootstrap.pypa.io/get-pip.py
--2016-08-04 15:50:04--  https://bootstrap.pypa.io/get-pip.py
Resolving bootstrap.pypa.io... 151.101.44.175
Connecting to bootstrap.pypa.io|151.101.44.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1524722 (1.5M) [text/x-python]
Saving to: ‘get-pip.py’

get-pip.py                                 100%[=====================================================================================>]   1.45M  2.20MB/s    in 0.7s

2016-08-04 15:50:05 (2.20 MB/s) - ‘get-pip.py’ saved [1524722/1524722]

bash-4.3$ sudo python get-pip.py
Password:
The directory '/Users/mona/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/mona/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
    100% |████████████████████████████████| 1.2MB 820kB/s
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |████████████████████████████████| 71kB 5.1MB/s
Installing collected packages: pip, wheel
  Found existing installation: pip 1.2.1
    Uninstalling pip-1.2.1:
      Successfully uninstalled pip-1.2.1
Successfully installed pip-8.1.2 wheel-0.29.0

With easy_install:

bash-4.3$ sudo easy_install pip
Searching for pip
Best match: pip 8.1.2
Adding pip 8.1.2 to easy-install.pth file
Installing pip3 script to /Library/Frameworks/Python.framework/Versions/3.4/bin
Installing pip3.5 script to /Library/Frameworks/Python.framework/Versions/3.4/bin
Installing pip script to /Library/Frameworks/Python.framework/Versions/3.4/bin

Using /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
Processing dependencies for pip
Finished processing dependencies for pip
bash-4.3$ python
Python 3.4.1 (default, Aug  4 2016, 13:53:56)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'pip'

and also another suggestion I saw in another SO post:

bash-4.3$ python3 -m pip
/usr/local/bin/python3: No module named pip
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408

0 Answers0