pip成功安装软件包,但在命令行中找不到可执行文件 [英] pip installs packages successfully, but executables not found from command line

查看:1031
本文介绍了pip成功安装软件包,但在命令行中找不到可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用10.10.3版的Mac OS X Yosemite.

I am working on mac OS X Yosemite, version 10.10.3.

我按照以下步骤使用macport安装了python2.7和pip http://johnlaudun.org/20150512-installing-and-setting- pip-with-macports/

I installed python2.7 and pip using macport as done in http://johnlaudun.org/20150512-installing-and-setting-pip-with-macports/

我可以成功安装软件包并将其导入我的python环境和python脚本中.但是,找不到与可从终端中的命令行调用的软件包相关联的可执行文件.

I can successfully install packages and import them inside my python environment and python scripts. However any executable associated with a package that can be called from the command line in the terminal are not found.

有人知道出什么问题吗?(下面有更多详细信息)

Does anyone know what might be wrong? (More details below)

例如,按照 http://wiki.ros的说明安装名为"rosdep"的软件包时.org/jade/Installation/Source

我可以运行:sudo pip install -U rosdep 会正确安装,并且相应的文件位于/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

I can run: sudo pip install -U rosdep which installs without errors and corresponding files are located in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

但是,如果我尝试运行:sudo rosdep init, 它给出了一个错误:"sudo: rosdep: command not found"

However if I try to run : sudo rosdep init, it gives an error : "sudo: rosdep: command not found"

这不是程序包特定的错误.对于在计算机上使用pip安装的任何软件包,我都会得到此信息.我什至尝试添加

This is not a package specific error. I get this for any package installed using pip on my computer. I even tried adding

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

到我的$PATH. 但是,即使这些程序包可以在python内正常运行,也无法在命令行上找到可执行文件.

to my $PATH. But the executables are not found on the command line, even though the packages work perfectly from within python.

推荐答案

检查您的$ PATH

check your $PATH

tox具有命令行模式:

audrey:tests jluc$ pip list | grep tox
tox (2.3.1)

在哪里?

audrey:tests jluc$ which tox
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/tox

我的$ PATH中有什么?

and what's in my $PATH?

audrey:tests jluc$ echo $PATH
/opt/chefdk/bin:/opt/chefdk/embedded/bin:/opt/local/bin:..../opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin...

是否注意到/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin ?这就是找到我点子安装的东西的原因

Notice the /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin? That's what allows finding my pip-installed stuff

现在,要查看Python的来源,请尝试执行此操作(将rosdep替换为tox).

Now, to see where things are from Python, try doing this (substitute rosdep for tox).

$python
>>> import tox
>>> tox.__file__

打印出的

:

'/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tox/__init__.pyc'

现在, cd 到上面lib上方的目录.您看到 bin 目录吗?您在那个垃圾箱中看到了rosdep吗?如果是这样,请尝试将bin添加到您的$ PATH中.

Now, cd to the directory right above lib in the above. Do you see a bin directory? Do you see rosdep in that bin? If so try adding the bin to your $PATH.

audrey:2.7 jluc$ cd /opt/local/Library/Frameworks/Python.framework/Versions/2.7
audrey:2.7 jluc$ ls -1

输出:

Headers
Python
Resources
bin
include
lib
man
share

这篇关于pip成功安装软件包,但在命令行中找不到可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆