在Python 3.6上使用brew安装pipenv

在Python 3.6上使用brew安装pipenv,python,homebrew,pipenv,Python,Homebrew,Pipenv,我正在尝试按照中的建议使用自制软件安装pipenv 首先,我运行了$brew安装pipenv。然后,brew自动安装python 3.7,我就可以正确使用pipenv了。但是,我想在Python 3.6上使用pipenv,所以我运行了$brew switch Python 3.7 3.6.5,然后当我尝试$pipenv安装时出现如下错误: dyld: Library not loaded: @executable_path/../.Python Referenced from: /usr/l

我正在尝试按照中的建议使用自制软件安装pipenv

首先,我运行了
$brew安装pipenv
。然后,brew自动安装python 3.7,我就可以正确使用pipenv了。但是,我想在Python 3.6上使用pipenv,所以我运行了
$brew switch Python 3.7 3.6.5
,然后当我尝试
$pipenv安装时出现如下错误:

dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7
  Reason: image not found
Abort trap: 6
是否有任何解决方案可以将pipenv与Python 3.6.5一起安装


谢谢。

您可以始终使用特定的Python使用pip进行安装:

python3 -m pip install --user pipenv

python3,这里假设您的版本是3.6.5,如果不是,那么使用所需Python的整个路径

试试这个,但首先安装python 3.6.5

pipenv --python 3.6.5

我也有同样的问题,花了很长时间研究。最后,我确定我的项目不一定需要
python3.6
,所以我将brew切换到
python3.7
,并重新安装了
pipenv

如果您确实需要将
pipenv
python3.6
一起使用,那么您可能会发现这很有帮助,但对我来说,这似乎是一个我不想使用的核心选项

如何将
pipenv
python3.7
结合使用:

# get your version of python3.7
brew list --versions python

# switch to your python3.7 version
brew switch python 3.7.x_x 

# install pipenv if it was removed during the troubleshooting process
brew install pipenv

# pipenv should work now
pipenv --help

确保您正在使用python3.6

$ python
Python 3.6.5 (default, Jun 17 2018, 12:13:06)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

$ brew switch python # if not, see your versions
Error: Usage: brew switch <formula> <version>
python installed versions: 3.6.5_1, 3.7.3

$ brew switch python 3.6.5_1 # change your version if is necessary
Cleaning /usr/local/Cellar/python/3.6.5_1
Cleaning /usr/local/Cellar/python/3.7.3
25 links created for /usr/local/Cellar/python/3.6.5_1
更改为pipenv 2018.6.25

$ brew unlink pipenv
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/2c0bbfa297e2429cd6e080ad5231f3aa56ff4f65/Formula/pipenv.rb
$ brew switch pipenv 2018.6.25

升级OSX版本后出现相同问题

通过卸载homebrew安装并遵循以下步骤解决:

如果您获得
pipenv:command not found
,请按照说明将用户库的二进制目录添加到您的路径中,对于OSX,请将其添加到~/.bash\u配置文件中:

export PATH=/Users/YOUR_USER_NAME/.local/bin:$PATH

您可以始终使用特定的Python使用pip进行安装这是唯一与我一起使用的解决方案,我的案例是“pipenv install”,引发了同样的上述错误,似乎pipeline针对的是错误的Python框架
export PATH=/Users/YOUR_USER_NAME/.local/bin:$PATH