Difference between pip3 and python3 -m pip

前端 未结 2 356
一生所求
一生所求 2020-12-30 04:02

I am trying to install some packages using pip and python3. I am using MacOS, so by default when I run pip, it uses my version of Python 2.

I have been able to insta

2条回答
  •  醉话见心
    2020-12-30 04:09

    As @tihorn says, pip3 and python3 -m pip should be the same. There is at least one exception: if they are not in the same path. I had the following setup:

    $ which pip3
    /usr/bin/pip3
    $ which python3
    /home/username/anaconda3/bin/python3
    

    After installing modules with pip3 and verifying with pip3 freeze, I was not able to access them when running python3 my_script.py or python3 -c 'import my_module'. I was getting a ModuleNotFound error.

提交回复
热议问题