为什么pip不适合我?

时间:2017-07-19 00:48:45

标签: 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

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

不是直接回答您的问题,但我建议您安装Linuxbrew并让它为您构建您的软件包。在这种情况下,/ usr / local / lib / python2.7 / site-packages是标准的包站点,但是你的Python无法以某种方式看到它。最后一件事,你应该是python2,pip2而不是泛型python,为了安全起见。