[pipenv]Warning: Python 3.7 was not found on your system…

前置条件:

切换到pipfile文件所在目录gotest_official

问题描述:

使用pipenv install创建虚拟环境,报错

wangju@wangju-HP-348-G4:~/Desktop/gotest_official$ pipenv install 
Warning: Python 3.7 was not found on your system…
You can specify specific versions of Python with:
  $ pipenv --python path/to/python

问题分析:

pipfile中记录的python版本与本地的python版本不一致导致

解决过程:

查看本地python版本

python3
Python 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

安装指定python版本的虚拟环境

pipenv --python 3.6

结果:

wangju@wangju-HP-348-G4:~/Desktop/gotest_official$ pipenv --python 3.6
Creating a virtualenv for this project…
Pipfile: /home/wangju/Desktop/gotest_official/Pipfile
Using /usr/bin/python3.6m (3.6.8) to create virtualenv…
⠧ Creating virtual environment...Already using interpreter /usr/bin/python3.6m
Using base prefix '/usr'
New python executable in /home/wangju/.virtualenvs/gotest_official-ZTIMAEbX/bin/python3.6m
Also creating executable in /home/wangju/.virtualenvs/gotest_official-ZTIMAEbX/bin/python
Installing setuptools, pip, wheel...
done.
Running virtualenv with interpreter /usr/bin/python3.6m

✔ Successfully created virtual environment! 
Virtualenv location: /home/wangju/.virtualenvs/gotest_official-ZTIMAEbX
Warning: Your Pipfile requires python_version 3.7, but you are using 3.6.8 (/home/wangju/./g/bin/python).
  $ pipenv --rm and rebuilding the virtual environment may resolve the issue.
  $ pipenv check will surely fail.

使用lsvirtualenv查看开发机虚拟环境列表,可以看到,gotest_official项目的虚拟环境已经创建成功了

猜你喜欢

转载自www.cnblogs.com/kaerxifa/p/11875710.html