python - 为什么 pip 不适合我?

标签 python python-2.7 pip

观察我如何使用 pip 安装 wstool,然后仍然无法从 CLI 调用它。我也把所有不同的路径放在那里。有人可以看到我的错误吗?

bash-3.2$ echo $PYTHONPATH
/usr/local/opt/python/libexec/bin/python
bash-3.2$ sudo -H python -m pip install -U wstool
Password:
Requirement already up-to-date: wstool in /usr/local/lib/python2.7/site-packages
Requirement already up-to-date: pyyaml in /usr/local/lib/python2.7/site-packages (from wstool)
Requirement already up-to-date: vcstools>=0.1.38 in /usr/local/lib/python2.7/site-packages (from wstool)
Requirement already up-to-date: python-dateutil in /usr/local/lib/python2.7/site-packages (from vcstools>=0.1.38->wstool)
Requirement already up-to-date: six>=1.5 in /usr/local/lib/python2.7/site-packages (from python-dateutil->vcstools>=0.1.38->wstool)

bash-3.2$ wstool
bash: wstool: command not found

bash-3.2$ pip install -U pip setuptools
Requirement already up-to-date: pip in /usr/local/lib/python2.7/site-packages
Requirement already up-to-date: setuptools in /usr/local/lib/python2.7/site-packages
bash-3.2$ wstool
bash: wstool: command not found
bash-3.2$ echo $PATH
/Users/pitosalas/.rbenv/shims:/usr/local/opt/python/libexec/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
bash-3.2$ echo $PYTHONPATH
/usr/local/opt/python/libexec/bin/python
bash-3.2$ which python
/usr/local/opt/python/libexec/bin/python
bash-3.2$ which pip
/usr/local/opt/python/libexec/bin/pip
bash-3.2$

新细节

~ ls /usr/local/opt/python/libexec/bin/wstool
ls: /usr/local/opt/python/libexec/bin/wstool: No such file or directory

那么,我的路是不是错了?这似乎是pip安装的...

ls -l /usr/local/lib/python2.7/site-packages/wstool-0.1.13.dist-info/
total 48
-rw-r--r--  1 pitosalas  admin    76 Jul 18 15:52 DESCRIPTION.rst
-rw-r--r--  1 pitosalas  admin   611 Jul 18 15:52 METADATA
-rw-r--r--  1 pitosalas  admin  1885 Jul 18 15:52 RECORD
-rw-r--r--  1 pitosalas  admin    93 Jul 18 15:52 WHEEL
-rw-r--r--  1 pitosalas  admin   738 Jul 18 15:52 metadata.json
-rw-r--r--  1 pitosalas  admin     7 Jul 18 15:52 top_level.txt

最佳答案

pip 不维护已安装软件包的数据库。目录*.dist-info其数据库。虽然目录 wstool-0.1.13.dist-info 存在,但 pip 认为该软件包已安装。

删除 dist-info 目录以使 pip 忘记该包并重新安装:

sudo rm -rf /usr/local/lib/python2.7/site-packages/wstool-0.1.13.dist-info
sudo python -m pip install -U wstool

关于python - 为什么 pip 不适合我?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45179256/

相关文章:

python - 如果不再支持OpenCV 2.4,如何安装?

Python在一个列表中查找不在另一个列表中的元素

python - 迭代与 order_by() 效率

Python 2 + Flask - 导入错误 : No module named request

python - 如何在运行 python 脚本时清除 cmd/terminal

python - 复杂的python列表处理

python - Scikit-learn 仅适用于 python 2,不适用于 python 3

python - 以与目录中相同的顺序输出文件名 - Python

python - 如何在 google Colab 中运行脚本 shell?

python - 在 python 中查找实例的所有成员,不包括 __init__