繁体   English   中英

在 Python 3.6 上使用 brew 安装 pipenv

[英]Install pipenv using brew on Python 3.6

我正在尝试按照此处的建议使用 Homebrew 安装 pipenv。

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

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 一起安装?

谢谢你。

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

如果您绝对需要将pipenvpython3.6一起使用,那么您可能会发现此线程很有帮助,但对我而言,这似乎是我不想经历的核选项。

如何重新使用pipenvpython3.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

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

pipenv --python 3.6.5

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

python3 -m pip install --user pipenv

python3,这里假设你的 3.6.5,如果不是,那么使用你想要的 Python 的整个路径。

https://github.com/pypa/pipenv/issues/2965

确保你使用的是 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

更改为 pipenv 2018.6.25

$ brew switch pipenv 2018.6.25

升级 OSX 版本后有同样的问题。

通过卸载自制软件安装并按照“实用安装”说明解决

brew uninstall pipenv
pip install --user pipenv

如果您收到pipenv: command not found ,请按照说明将用户库的二进制目录添加到您的 PATH 中,对于 OSX,请将其添加到您的 ~/.bash_profile 中:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM