使用使用Debian 4.14.34-v7+的Raspberry Pi,我试图用Python 3.6.5作为Python的默认版本设置pipenv.我首先通过在Pi上编译Python 3.6(小时…).制作了一个"robot"目录后,我安装了pipenvsudo pip3 install pipenv以及pipenv install --three.

Then I start the shell and open up Python, getting Python 3.5.3…

pi@raspberrypi:~/robot $ pipenv shell
Spawning environment shell (/bin/bash). Use 'exit' to leave.
. /home/pi/.local/share/virtualenvs/robot-XZ3Md9g0/bin/activate
pi@raspberrypi:~/robot $ . /home/pi/.local/share/virtualenvs/robot-XZ3Md9g0/bin/activate
(robot-XZ3Md9g0) pi@raspberrypi:~/robot $ python
Python 3.5.3 (default, Jan 19 2017, 14:11:04) 
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

I then change the virtualenv by pipenv --python 3.6, but after it correctly (apparently) installs, I immediately get the warning that pipenv still expects Python 3.5…

(robot-XZ3Md9g0) pi@raspberrypi:~/robot $ pipenv --python 3.6
Virtualenv already exists!
Remove existing virtualenv? [Y/n]: y
Removing existing virtualenv…
Creating a virtualenv for this project…
Using /usr/local/bin/python3.6m (3.6.5) to create virtualenv…
⠋Running virtualenv with interpreter /usr/local/bin/python3.6m
Using base prefix '/usr/local'
New python executable in /home/pi/.local/share/virtualenvs/robot-XZ3Md9g0/bin/python3.6m
Also creating executable in /home/pi/.local/share/virtualenvs/robot-XZ3Md9g0/bin/python
Installing setuptools, pip, wheel...done.

Virtualenv location: /home/pi/.local/share/virtualenvs/robot-XZ3Md9g0
Warning: Your Pipfile requires python_version 3.5, but you are using 3.6.5 (/home/pi/.local/share/v/r/bin/python).
  $ pipenv check will surely fail.
(robot-XZ3Md9g0) pi@raspberrypi:~/robot $ python
Python 3.6.5 (default, May  3 2018, 11:25:17) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

当我第一次创建virtualenv时,如何设置pipenv来查找Python 3.6?我可以手动进入并编辑PIP文件,但这似乎违背了让pipenv人帮我处理事情的目的.

推荐答案

如果要更改现有环境的Python版本,"编辑Pipfile"是正确的方法.

如果希望使用Python 3.6创建new环境,可以运行

pipenv install --python 3.6

而不是

pipenv install --three

这就应该奏效了.

如果创建了新环境,只需确保删除旧的PIP文件,否则命令将失败.

Python-3.x相关问答推荐

这是重命名极地df列的最好方式吗?

我的SELECT函数搜索的是列,而不是列中的数据.我怎么才能让它搜索数据呢?

在Python中从列创建新行

如何将多个字典合并到一个列中,并为不同的行使用相同的键

基于其他列的条件向Panda数据框中添加值到新列

将自动文本转换为 DataFrame

使用 NaN 计算 pct_change 时如何避免 bfill 或 ffill

在 Python 中实现 COM 接口

使用 selenium 加速网页抓取

使用 pandas 数据帧映射到中转( node )点的跨容量请求

为什么最简单的流光示例会出错?

内部如何使用 Python 语法?

无法在 macOS 上的 Anaconda3 python3.6 上安装 OpenCV3

Python 3 list(dictionary.keys()) 引发错误.我究竟做错了什么?

Tkinter AttributeError:对象没有属性'tk'

全局捕获快速 api 中的异常

如何用pymongo连接远程mongodb

Asyncio RuntimeError:事件循环已关闭

AttributeError:系列对象没有属性iterrows

Pyodbc:登录超时错误