我正在尝试在便携式python旁边的USB驱动器F:上安装pip,但似乎无法正常工作。我使用Git-bash(msy​​s)作为命令行。请参阅以下我的尝试:

MYPC /f
$ which python
/f/ppython275/App/python

MYPC /f
$ which pip

MYPC /f
$ python get-pip.py
Downloading/unpacking pip
  Downloading pip-1.5.tar.gz (898kB): 898kB downloaded
  Running setup.py egg_info for package pip

    warning: no files found matching 'pip\cacert.pem'
    warning: no files found matching '*.html' under directory 'docs'
    warning: no previously-included files matching '*.rst' found under directory 'docs\_build'
    no previously-included directories found matching 'docs\_build\_sources'
Installing collected packages: pip
  Running setup.py install for pip

    warning: no files found matching 'pip\cacert.pem'
    warning: no files found matching '*.html' under directory 'docs'
    warning: no previously-included files matching '*.rst' found under directory 'docs\_build'
    no previously-included directories found matching 'docs\_build\_sources'
    Installing pip-script.py script to f:\ppython275\App\Scripts
    Installing pip.exe script to f:\ppython275\App\Scripts
    Installing pip.exe.manifest script to f:\ppython275\App\Scripts
    Installing pip2.7-script.py script to f:\ppython275\App\Scripts
    Installing pip2.7.exe script to f:\ppython275\App\Scripts
    Installing pip2.7.exe.manifest script to f:\ppython275\App\Scripts
    Installing pip2-script.py script to f:\ppython275\App\Scripts
    Installing pip2.exe script to f:\ppython275\App\Scripts
    Installing pip2.exe.manifest script to f:\ppython275\App\Scripts
Successfully installed pip
Cleaning up...

MYPC /f
$ which pip


我已经重新启动了命令行。但“哪一个点”仍然无法产生任何效果。我怎样才能解决这个问题?

最佳答案

您需要编辑$PATH环境变量以添加/f/ppython275/App/Scripts,以便外壳程序在该目录中查找可执行文件。

编辑您的~/.bashrc~/.bash_profile并添加以下内容:

export PATH=$PATH:/f/ppython275/App/Scripts


保存,重新启动外壳程序,您应该已经准备就绪。

关于python - 如何在USB驱动器上便携式安装pip?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21028026/

10-12 01:05