Binding python interpreter used by my project and pipenv

Installation of my requirements fails:

» pipenv --python 3.6.4 install
Creating a virtualenv for this project…
Using /home/myuser/.pyenv/versions/3.6.4/bin/python3.6m to create virtualenv…
⠋Running virtualenv with interpreter /home/myuser/.pyenv/versions/3.6.4/bin/python3.6m
Using base prefix '/home/myuser/.pyenv/versions/3.6.4'
New python executable in /home/myuser/.local/share/virtualenvs/svc-J_VF07t3/bin/python3.6m
Also creating executable in /home/myuser/.local/share/virtualenvs/svc-J_VF07t3/bin/python
Please make sure you remove any previous custom paths from your /home/myuser/.pydistutils.cfg file.
Installing setuptools, pip, wheel...done.

Virtualenv location: /home/myuser/.local/share/virtualenvs/svc-J_VF07t3
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
n2.7/site-packages/pipenv/resolver.py", line 11, in <module>
    import pipenv.utils
  File "/home/myuser/.local/lib/python2.7/site-packages/pipenv/../pipenv/__init__.py", line 17, in <module>
    from .cli import cli
  File "/home/myuser/.local/lib/python2.7/site-packages/pipenv/../pipenv/cli.py", line 10, in <module>
    import delegator
  File "/home/myuser/.local/lib/python2.7/site-packages/pipenv/vendor/delegator.py", line 8, in <module>
    from pexpect.popen_spawn import PopenSpawn
  File "/home/myuser/.local/lib/python2.7/site-packages/pipenv/vendor/pexpect/popen_spawn.py", line 14, in <module>
    from Queue import Queue, Empty  # Python 2
ModuleNotFoundError: No module named 'Queue'

/home/myuser/.local/lib/python2.7/site-packages/pipenv/utils.py:1147: ResourceWarning: Implicitly cleaning up <TemporaryDirectory '/tmp/pipenv-cLTIqh-requirements'>
  warnings.warn(warn_message, ResourceWarning)

Why Python 2.7? Let it check the python version used in virtualenv:

» pipenv shell
Spawning environment shell (/bin/bash). Use 'exit' to leave.
. /home/myuser/.local/share/virtualenvs/svc-J_VF07t3/bin/activate
» . /home/myuser/.local/share/virtualenvs/svc-J_VF07t3/bin/activate
» python --version
Python 3.6.4

Correctly! How about pipenv:

» which pipenv
/home/myuser/.local/bin/pipenv

So, it seems that the problem is that although mine virtualenvuses Python 3, pipenvit uses itself Python 2(Python system). pipenvwas installed as recommended using the python system-wide interpreter:

pip install --user pipenv

And it really is installed and found:

» which pipenv
/home/myuser/.local/bin/pipenv

» pipenv --version
pipenv, version 11.1.3

It wouldn't make sense to reinstall pipenvaccording to the python interpreter that my project will use.

pipenv python virtualenv python? python, pipenv, python, ?

+4

Source: https://habr.com/ru/post/1695963/


All Articles