如何在 Mac (2021) 上安装“virtualenvwrapper”?

时间:2021-07-02 00:28:53

标签: python python-3.x macos

我很难找到仍然相关的教程。自 2021 年起,virtualenvwrapper 是否不再适用于 Mac (OS 11.4)?

我在打开 zsh 时得到这个:

/Library/Developer/CommandLineTools/usr/bin/python3: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ModuleNotFoundError: No module named 'virtualenvwrapper')
virtualenvwrapper.sh: There was a problem running the initialization hooks.

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 and that PATH is
set properly.
➜  ~ echo $VIRTUALENVWRAPPER_PYTHON
/usr/bin/python3
➜  ~ which virtualenv
/usr/local/bin/virtualenv
➜  ~ which virtualenvwrapper.sh
/usr/local/bin/virtualenvwrapper.sh

其中我的 ~/.zshrc 包含:

export PATH=/usr/local/bin:$PATH
export PATH="/usr/local/sbin:$PATH"

# For virtualenvwrapper
export PATH=/usr/local/share/python:$PATH
export WORKON_HOME=${HOME}/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
#export VIRTUALENVWRAPPER_VIRTUALENV=${HOME}/.local/bin/virtualenv
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source $(which virtualenvwrapper.sh) 

我不再从 https://www.python.org/downloads/ 下载的 Mac 安装程序安装 python3。

我似乎安装了不少于三个 python3:

/usr/bin/python3
/usr/local/bin/python3
/Library/Developer/CommandLineTools/usr/bin/python3

而我最近尝试使用 brew 安装 python3 的尝试在 pygobject 处失败:

➜  ~ brew reinstall pygobject
==> Downloading https://download.gnome.org/sources/pygobject/2.28/pygobject-2.28.7.tar.xz
Already downloaded: /Users/stellios/Library/Caches/Homebrew/downloads/229c52d9a07d25ee8cea203c1a0a6d567c422a034c9ff0a686a9f84e0fa0fd68--pygobject-2.28.7.tar.xz
==> Reinstalling pygobject 
Error: An exception occurred within a child process:
  FormulaUnavailableError: No available formula with the name "/usr/local/opt/pygobject/.brew/pygobject.rb".

1 个答案:

答案 0 :(得分:0)

我仍然不知道为什么所有的 python3 版本和位置,但标准化 SQL> alter session set events '10155'; Session altered. SQL> explain plan for 2 select P.* 3 from index_filter_parent "P" 4 join index_filter_child "C" 5 on C.code = P.code 6 where P.code in('A','Z') ; Explained. SQL> @xplan typical PLAN_TABLE_OUTPUT ---------------------------------------------------------------------------------------------------------------- Plan hash value: 2543178509 ---------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ---------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 52 | 364 | 4 (0)| 00:00:01 | | 1 | NESTED LOOPS | | 52 | 364 | 4 (0)| 00:00:01 | | 2 | INLIST ITERATOR | | | | | | | 3 | TABLE ACCESS BY INDEX ROWID BATCHED| INDEX_FILTER_PARENT | 2 | 10 | 2 (0)| 00:00:01 | |* 4 | INDEX RANGE SCAN | IX_INDEX_FILTER_PARENT | 2 | | 1 (0)| 00:00:01 | |* 5 | INDEX RANGE SCAN | IX_INDEX_FILTER_CHILD | 26 | 52 | 1 (0)| 00:00:01 | ---------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 4 - access("P"."CODE"='A' OR "P"."CODE"='Z') 5 - access("C"."CODE"="P"."CODE") Note ----- - this is an adaptive plan 22 rows selected. 似乎解决了我的问题。

/usr/loca/bin