#python #pip
#python #pip
Вопрос:
Pip был на моей машине в течение многих лет, но в последнее время я не мог заставить его работать. Чтобы исправить это, я запустил:
$ sudo python get-pip.py
The directory '/Users/tomeldridge/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/tomeldridge/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
Downloading pip-8.1.2-py2.py3-none-any.whl (1.2MB)
100% |████████████████████████████████| 1.2MB 759kB/s
Collecting wheel
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |████████████████████████████████| 71kB 4.3MB/s
Installing collected packages: pip, wheel
Found existing installation: pip 7.1.2
Uninstalling pip-7.1.2:
Successfully uninstalled pip-7.1.2
Successfully installed pip-8.1.2 wheel-0.29.0
Но pip по-прежнему не работает:
$ pip --version
-bash: pip: command not found
Я думаю, что, возможно, я вызвал эту проблему $PATH
.
Когда я запускаю `sudo bash -c ‘echo $PATH’, я получаю:
/usr/sbin:/usr/bin:/sbin:/bin:usr/local/bin
Это правильно?
Комментарии:
1.
pip
(и большинство библиотек) обычно устанавливаются в пользовательской области. Возможно, вы вошли в другую учетную запись пользователя?2. как насчет этой команды: «python -m pip —version»?
3. можете ли вы проверить, есть ли исполняемый файл с именем pip в
/usr/local/opt
?
Ответ №1:
Ваша проблема usr/local/bin
на вашем пути, она должна быть /usr/local/bin
.
Это должно сделать это.
Вы должны иметь возможность изменить это в файле ~/.bash_profile
.