How to install pip on python 3.6, not the default

2019-02-24 21:36发布

So all day, I have been trying to install pip. I've executed curl https://bootstrap.pypa.io/get-pip.py > get-pip.py. Then sudo python get-pip.py. Next I went to install numpy with sudo pip install numpy. Finally, I opened up the python 3.6 IDLE and I tried to import numpy as np and got an error saying that the module didn't exist.

I found out that the pip was installed in /Library/Python/2.7/site-packages so I deleted 2.7 from the directory. I redid the whole process again and got the same error :|

I'm wondering if I need to change the default python which I've been told is not wise. What do I do? I' sure I've deleted everything with python 2.7 in it?

MacBookAir OSX - Sierra

Or is there an alternate way that I can install numpy in python 3.6????

1条回答
可以哭但决不认输i
2楼-- · 2019-02-24 22:29

You shouldn't delete the system python. Delete nothing in /Library/Python or it's subfolders.

How did you install python 3.6? Usually, it'll be installed as python3.6 with a symlink to python3. pip3 is usually installed with it.

So what you probably wanted to do was:

pip3 install numpy
python3
>>> import numpy
查看更多
登录 后发表回答