python 的多个安装,通过 pip 安装的软件包位于错误的目录 windows

multiple install of python, package install by pip are in wrong directory windows

我知道之前已经回答过类似的问题,但我在安装 Anaconda 后安装 python 2.7 时犯了一个错误。现在,当我在 cmd 中使用 pip 功能时,它会将包安装在 python 2.7 文件夹中,而不是 Anaconda 文件夹中。在 cmd 中使用 python -m pip 函数我得到:

c:/python27/python .exe -m pip

我只想使用 Anaconda 目录而不是这个目录。有什么简单的方法可以指定它吗?

谢谢..

您必须更改 PATH 环境变量,以便删除 Python 2.7 目录。最简单的方法是卸载这个额外的 Python 版本。如果您想直接编辑 PATH,请参阅此处:https://superuser.com/a/284351/229278

引用Windows的答案:

Windows

GUI

  1. Open Control Panel » System » Advanced » Environment Variables.

  2. Type control sysdm.cpl,,3 in the Run dialog (+R) and click Environment Variables.
    For editing user variables you can also type

    %windir%\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables
    

    in the Run dialog.

  3. Right-click (My) Computer and click on Properties, or simply press +Break.

    • In XP click on Advanced » Environment Variables.
    • In Vista+ click on Advanced system settings » Environment Variables.
  4. There are many other ways of reaching the same place, such as by typing "environment variables" in the Start Menu/Screen search box and so on.

Environment variables in Windows are separated into user and machine/system specific values. You can view and edit their values there. Their current values upon launch are made available to all programs.

There is also Rapid Environment Editor, which helps setting and changing environment variables in Windows without the need to go deep into the system settings. Another open source program for Windows with which the path environment can be edited very conveniently is Path Editor.