13

I know that pip3 refers to python3 and pip refers to python2. When I use anaconda environment and set the python version as 3.5, I install a package names itchat as following.

pip3 install itchat

The installation goes on successfully without any errors.

But when I type the following commands, strange things happen. enter image description here

But if I just use pip install itchat and type python instead of python3, things go on as I think. enter image description here

I am wondering what leads to this result. Why there is the difference between python and python3?

Thanks for providing your answers!

Boooooooooms
  • 306
  • 4
  • 21
  • 1
    had a similar issue using django packages. running pip3 as root solved it to me. I still have no idea what caused it. – TomBombadil May 17 '18 at 11:49
  • 3
    They may both be Python 3.5.5, but do they refer to the same binary? Maybe you have `/usr/bin/python` and `/usr/local/bin/python3`, for example, and each points to a different infrastructure. – chepner May 17 '18 at 11:49
  • 3
    type `which python` and `which python3` – Chris_Rands May 17 '18 at 11:50
  • 2
    Compare output of `which python` and `which python3` – DeepSpace May 17 '18 at 11:51
  • 1
    have a look here : https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – Dadep May 17 '18 at 12:11
  • 1
    @TomBombadil most probably you have different `PATH` env vars when running `pip3` and `sudo pip3`. Run `echo $PATH` and `sudo echo $PATH` and check what's different. – hoefling May 17 '18 at 19:52
  • @DeepSpace @chepner They are the same `PATH`, I think. For `which python`: `/anaconda3/envs/myPy3.5/bin/python` For `which python3`: `/anaconda3/envs/myPy3.5/bin/python3` – Boooooooooms May 18 '18 at 10:51
  • 1
    I don't see you using conda environment. Create an environment, activate and then install the package. – jalazbe Aug 13 '18 at 09:40
  • @jalazbe Aug Yes, I finally created the conda python environment and solved this problem. – Boooooooooms Aug 17 '18 at 06:16
  • @Boooooooooms I wrote the solution. Could you mark it as resolved? – jalazbe Aug 17 '18 at 07:25

1 Answers1

-6

I don't see you using conda environment.

Create an environment

conda create -n myenv

activate the envinronment:

conda activate myenv

and then install the package

conda install itchat 

or

pip install itchat
jalazbe
  • 1,801
  • 3
  • 19
  • 40
  • 2
    I understand it solves the problem. But it doesn't answer the question. `Why there is the difference between python and python3` – F.S. Mar 20 '20 at 22:57
  • this link can be helpful if above answers are not understood https://www.pythonpool.com/pip-vs-pip3/ – ZKS Dec 17 '21 at 15:30