gpt4 book ai didi

python - bash_profile 配置困惑

转载 作者:太空宇宙 更新时间:2023-11-03 23:13:00 26 4
gpt4 key购买 nike

我正在尝试使用此链接中的第 5 步安装 Python 虚拟环境 Install OpenCV 3 on macOS with Homebrew (the easy way)

我在正确配置这个文件时遇到了问题

$ nano ~/.bash_profile

只编辑 bash_profile like show

# Virtualenv/VirtualenvWrapper
source /usr/local/bin/virtualenvwrapper.sh

不允许我进入下一步

我收到这个警告 mkvirtualenv: command not found

因此使用此 techstricks.com/mkvirtualenv-command-not-found-virtualenvwrapper/

的帮助改变了它

找到关于如何使用 virtualenwrapper 的链接 virtualenvwrapper.readthedocs.io/en/latest/install.html#python-interpreter-virtualenv-and-path

我的 bash_profile 包含

    #Homebrew
export PATH=/usr/local/bin:$PATH

export WORKON_HOME=$HOME/.virtualenvs

# Virtualenv/VirtualenvWrapper
source /usr/local/bin/virtualenvwrapper.sh
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'

当我尝试 $ source ~/.bash_profile

我明白了

-bash: /usr/local/bin/python: No such file or directory
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/local/bin/python and that PATH is
set properly.

我该如何解决这个问题??????

最佳答案

我终于让它工作了。

我分别安装了 Virtualenv 和 Wrapper

pip install virtualenv

将来可能会帮助某人。


我使用

安装了 Virtual Enviornment Wrapper
pip install --user virtualenvwrapper

链接

virtualenvwrapper.readthedocs.io/en/latest/install.html#python-interpreter-virtualenv-and-path

我的 bash_profile 文件的内容

Homebrew

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

#export WORKON_HOME=$HOME/.virtualenvs

# Virtualenv/VirtualenvWrapper source /usr/local/bin/virtualenvwrapper.sh #export PROJECT_HOME=$HOME/Devel #export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python #export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv #export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'

我的 bashrc 文件的内容

export WORKON_HOME=$HOME/.virtualenvs

export PROJECT_HOME=$HOME/projects

source /usr/local/bin/virtualenvwrapper.sh

关于python - bash_profile 配置困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45736112/

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