Virtualenv:找不到命令 [英] Virtualenv: Command not found

查看:51
本文介绍了Virtualenv:找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试创建我的 virtualenv 文件夹时遇到问题,因为我的终端说似乎没有安装 virtualenv.

I'm having problems trying to create my virtualenv folders' since my terminal says that virtualenv seems not to be installed.

我做了什么:

sudo pip install virtualenv

有了这个回复:

The directory '/Users/ricardogonzales/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/ricardogonzales/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.
Collecting virtualenv
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading virtualenv-13.1.0-py2.py3-none-any.whl (1.7MB)
    100% |████████████████████████████████| 1.7MB 59kB/s
Installing collected packages: virtualenv
Successfully installed virtualenv-13.1.0

在那之后我运行了 virtualenv venv 并且我得到了这个响应:command not found

After that I've run virtualenv venv and I'm getting this response: command not found

我已经像这里的其他人一样执行了这个命令 (brew info python),但他们的终端响应与我的不同.

I've execute this command (brew info python) like other persons around here with the same problem but their responses from the terminal is not the same as my.

酿造信息响应:

python: stable 2.7.10 (bottled), HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/python.rb
==> Dependencies
Build: pkg-config ✘
Required: openssl ✘
Recommended: readline ✘, sqlite ✘, gdbm ✘
Optional: homebrew/dupes/tcl-tk ✘, berkeley-db4 ✘
==> Options
--universal
    Build a universal binary
--with-berkeley-db4
    Build with berkeley-db4 support
--with-poll
    Enable select.poll, which is not fully implemented on OS X (https://bugs.python.org/issue5154)
--with-quicktest
    Run `make quicktest` after the build (for devs; may fail)
--with-tcl-tk
    Use Homebrew's Tk instead of OS X Tk (has optional Cocoa and threads support)
--without-gdbm
    Build without gdbm support
--without-readline
    Build without readline support
--without-sqlite
    Build without sqlite support
--HEAD
    Install HEAD version
==> Caveats
Pip and setuptools have been installed. To update them
  pip install --upgrade pip setuptools

You can install Python packages with
  pip install <package>

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

See: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Homebrew-and-Python.md

我不知道未安装"是怎么写的,但是当我运行 python --version 我得到 Python 2.7.6 但如果我去usr/local/bin 我看不到任何 python 2.7 或者我看到的是很多 python3.

I don't know how it says "Not installed" but when I run python --version I'm getting Python 2.7.6 but if I go to usr/local/bin I can not see any python 2.7 or something what I see is a lot of python3.

有什么帮助吗?或尝试解决此问题的建议将非常受欢迎.

Any help? or suggestion to try to resolve this will be very aprecciated.

答案:

我已经解决了这个问题,卸载了 virtualenv 并重新安装,没有任何额外的配置或其他东西.

I've resolved this issue uninstalling the virtualenv and installing again without any extra configuration or something.

sudo pip uninstall virtualenv
sudo pip install virtualenv

推荐答案

您已经根据 brew info 安装了 Python 2.7.10.python --version 返回 2.7.6,因此您可能使用的是与 OS X 捆绑在一起的 Python.要解决此问题,请运行:brew link python,确认它通过运行 which python 正确链接.它应该返回 /usr/local/bin/python(除非你已经将 Homebrew 安装在 /usr/local 之外的另一个目录中).

You've installed Python 2.7.10 according to brew info. python --version returns 2.7.6, so you're probably using the Python that's bundled with OS X. To fix that, run: brew link python, confirm that it is linked correctly by running which python. It should return /usr/local/bin/python (unless you've installed Homebrew in another directory than /usr/local).

之后,您可能需要使用之前使用过的命令重新安装 virtualenv,因为 brew link python 也会更新 pip 的路径(pip 链接到 /usr/local 中的 Python 安装.

After that, you probably need to reinstall virtualenv using the command you've used before, because brew link python will also update the path to pip (the version of pip which is linked to your Python install in /usr/local).

这篇关于Virtualenv:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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