我使用以下命令安装环境pipenv。 Python3.7.4。
关于系统:
$ uname -a
Linux *** 4.19.0-5-amd64 #1 SMP Debian 4.19.37-6 (2019-07-18) x86_64 GNU/Linux
文件.env
WORKON_HOME=/usr/local/envs
PIPENV_DEFAULT_PYTHON_VERSION=3.7.4
日志
Loading .env environment variables…
Creating a virtualenv for this project…
Using /usr/bin/python3 (3.7.4) to create virtualenv…
⠋/usr/bin/python3: No module named pipenv.pew
Virtualenv location:
requirements.txt found, instead of Pipfile! Converting…
Traceback (most recent call last):
File "/usr/bin/pipenv", line 11, in <module>
load_entry_point('pipenv==11.9.0', 'console_scripts', 'pipenv')()
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pipenv/cli.py", line 572, in shell
three=three, python=python, fancy=fancy, shell_args=shell_args
File "/usr/lib/python3/dist-packages/pipenv/core.py", line 2093, in do_shell
ensure_project(three=three, python=python, validate=False)
File "/usr/lib/python3/dist-packages/pipenv/core.py", line 636, in ensure_project
ensure_pipfile(validate=validate, skip_requirements=skip_requirements)
File "/usr/lib/python3/dist-packages/pipenv/core.py", line 265, in ensure_pipfile
project.create_pipfile(python=python)
File "/usr/lib/python3/dist-packages/pipenv/project.py", line 518, in create_pipfile
'python_version': python_version(required_python)[: len('2.7')]
TypeError: 'NoneType' object is not subscriptable
使用命令安装 pipenv
sudo apt install python3-pipenv
我尝试使用 Python 版本运行:在文件.env
和命令行参数中 - 重复了这个结果。在 StaсkOverflow 上有一个类似的问题,但解决方案不适合我。我对语言环境没有问题。
答案1
这是一个老问题,但也许这可以帮助像我一样遇到这个问题的人:
我可以通过使用来避免这个问题python3 -m pipenv
。
在我的情况下,没有安装 Python 2,python
PATH 中也没有可执行文件。为了解决这个问题,我创建了一个符号链接:
# find location of python3
$ which python3
/usr/bin/python3
# create link from python to python3 in the original directory
$ ln -s /usr/bin/python3 /usr/bin/python