我使用以下命令安裝環境管彭夫。 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
使用指令安裝 pipelinev
sudo apt install python3-pipenv
我嘗試使用 Python 版本運行:在文件.env
和命令列參數中 - 這個結果重複了。在 StaсkOverflow 上有一個類似的問題,但解決方案不適合我。我對語言環境沒有任何問題。
答案1
老問題,但這也許可以幫助像我這樣遇到這個問題的人:
我能夠透過使用來避免這個問題python3 -m pipenv
。
就我而言,我的 PATH 中沒有安裝 Python 2,也沒有python
可執行檔。為了解決這個問題,我創建了一個符號連結:
# 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