I have Python installed twice in my computer. The python.exe file is located once under C:\Python34 and again under C:\Anaconda3. The first was installed through the standard Python installation, while the second through the Anaconda package which has the same standard Python plus some extra extensions. Both Python versions are 3.4.4. Now, I was trying to install a Python library/extension (e.g. facebook library). This can be done by typing this in the command line:

pip install facebook

The pip keyword is a Python module that simplifies the installation of external libraries. In my case this installs the facebook library only for the standard Python, not for the Anaconda Python. What I would like instead is to install the library for the Anaconda Python. I can tell because the facebook library is being created under C:\Python34\Lib\site-packages, but not under C:\Anaconda3\Lib\site-packages.

So, why is the library choosing the first Python, and ignoring the second? And, how can I control this behavior?

EDIT: Maybe it's worth mentioning that both C:\Python34 and C:\Anaconda3 are included in the Path environment variables. C:\Python34 comes first, and then C:\Anaconda3, but I also tried to put C:\Anaconda3 first, and then C:\Python34 and tried the installation again. However, the library was again installed in the standard Python. Also, pip is installed in both Pythons.

  • Which folder appears in the path first (from the left)? You are likely invoking that instance of pip. check your python dirs to make sure they both have pip, and then try to call it with the full path to update each instance seperately. eg c:\python34\...\pip.exe install facebook and c:\anaconda3\...\pip.exe install facebook – Frank Thomas Jun 25 '15 at 13:16
  • @FrankThomas I added some edits to my question. I was trying to execute it via the full pip path, but there is no pip.exe file in there. I tried C:\Anaconda3\Lib\site-packages\pip_init_.py, but that didn't work either. – multigoodverse Jun 25 '15 at 13:37
  • You could uninstall python34 ;) – DavidPostill Jun 25 '15 at 13:44
  • @DavidPostill, I know the solution - I don't know the reason :). – multigoodverse Jun 25 '15 at 13:55
  • Are there any other environment variables that are python related? – DavidPostill Jun 25 '15 at 13:57

So, why is the library choosing the first Python, and ignoring the second?

Most likely because C:\Python34 precedes C:\Anaconda3 in your PATH.

And, how can I control this behavior?

Invoke Anaconda's pip, which should be located in C:\Anaconda3\Scripts.

| improve this answer | |
  • Your answer is half-wrong because having C:\Anaconda3 precede C:\Python34 didn't fix the problem. Instead, having C:\Anaconda3\Scripts precede C:\Python34\Scripts did fix the problem. Your answer is half-correct because invoking Anaconda's pip full path C:\Anaconda\Scripts\pip.exe in the command line also fixes the problem. – multigoodverse Jun 25 '15 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.