gpt4 book ai didi

python - Virtualenv:找不到命令

转载 作者:太空狗 更新时间:2023-10-29 19:27:40 28 4
gpt4 key购买 nike

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

我做了什么:

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

我已经像周围遇到同样问题的其他人一样执行了这个命令 (brew info python),但是他们从终端得到的响应与我的不一样。

酿造信息响应:

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。

有什么帮助吗?或尝试解决此问题的建议将非常感激。

回答:

我已经解决了这个问题,卸载 virtualenv 并在没有任何额外配置或其他东西的情况下再次安装。

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(除非您在 /usr/local 之外的其他目录中安装了 Homebrew)。

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

关于python - Virtualenv:找不到命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31707557/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com