Install pipenv using brew on Python 3.6

对着背影说爱祢 提交于 2020-01-14 14:09:02

问题


I am trying to install pipenv using Homebrew as suggested in here.

First, I ran $ brew install pipenv. Then, brew install python 3.7 automatically and I can use pipenv properly. But, I want to use pipenv on Python 3.6, so I ran $ brew switch python 3.7 3.6.5 and then when I tried $ pipenv install an error appeared as follow:

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

Is there any solution to install pipenv along with Python 3.6.5?

Thank you.


回答1:


I had the same issue and spent a long time researching. In the end I determined my project did not absolutely need python3.6 so I switched brew to python3.7 and reinstalled pipenv.

If you absolutely need to use pipenv with python3.6 then you may find this thread helpful but to me it seemed like a nuclear option I didn't want to go through.

How to move back to using pipenv with 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



回答2:


You can always install using your specific Python using pip:

python3 -m pip install --user pipenv

python3, here assumes your 3.6.5, if not then use the whole path to your desired Python.




回答3:


Try this, but first install python 3.6.5

pipenv --python 3.6.5



回答4:


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

Make sure you're using 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

Install pipenv 2018.6.25

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

Change to pipenv 2018.6.25

$ brew switch pipenv 2018.6.25



回答5:


Had the same issue after upgrading OSX version.

Solved by uninstalling homebrew installation and following the "Pragmatic Installation" instructions:

brew uninstall pipenv
pip install --user pipenv

If you get pipenv: command not found, add the user base’s binary directory to your PATH per the instructions, for OSX add this to your ~/.bash_profile:

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


来源:https://stackoverflow.com/questions/54027090/install-pipenv-using-brew-on-python-3-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!