bash:pip安装后找不到命令

时间:2018-01-08 19:57:54

标签: python bash macos pip virtualenv

我正在设置一个新的Macbook Pro,但奇怪的是我期望在pip3 install之后工作的命令行快捷方式都无效。例如:

Kurts-MacBook-Pro:~ kurtpeek$ pip3 install --upgrade virtualenv
Requirement already up-to-date: virtualenv in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Kurts-MacBook-Pro:~ kurtpeek$ virtualenv venv
-bash: virtualenv: command not found

显示virtualenv无效。类似地,

Kurts-MacBook-Pro:~ kurtpeek$ pip3 install --upgrade ipython
Requirement already up-to-date: ipython in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requirement already up-to-date: prompt-toolkit<2.0.0,>=1.0.4 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: traitlets>=4.2 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: pickleshare in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: appnope; sys_platform == "darwin" in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: pygments in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: setuptools>=18.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: simplegeneric>0.8 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: decorator in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: jedi>=0.10 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: pexpect; sys_platform != "win32" in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from ipython)
Requirement already up-to-date: six>=1.9.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Requirement already up-to-date: wcwidth in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython)
Requirement already up-to-date: ipython-genutils in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from traitlets>=4.2->ipython)
Requirement already up-to-date: parso==0.1.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from jedi>=0.10->ipython)
Requirement already up-to-date: ptyprocess>=0.5 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pexpect; sys_platform != "win32"->ipython)

接着是

Kurts-MacBook-Pro:~ kurtpeek$ ipython
-bash: ipython: command not found

简而言之,由于某些原因,似乎没有正确安装与这些程序相对应的命令行快捷方式。知道什么可能是错的吗?

1 个答案:

答案 0 :(得分:0)

virtualenv不是一个开箱即用的Python 3命令(或者至少是我拥有的Homebrew变体)。创建virtualenv的命令是

python3 -mvenv dir

dir和(在Bash中)创建virtualenv

. dir/bin/activate

激活它。