Python 3.5,更高版本3.6安装了自制软件和django,虚拟环境带有pip。
不知何故,正常的env显示了Python的3.6版和3.5的虚拟环境,如下所示:
MacBook-Pro-Frank:~ Frank$ pip3 --version
pip 9.0.3 from /usr/local/lib/python3.6/site-packages (python 3.6)
MacBook-Pro-Frank:~ Frank$ pipenv shell
Spawning environment shell (/bin/bash). Use 'exit' to leave.
bash-3.2$ . /Users/Frank/.local/share/virtualenvs/Frank-ZvIKOxyS/bin/activate
(Frank-ZvIKOxyS) bash-3.2$ pip3 --version
pip 9.0.1 from /Users/Frank/.local/share/virtualenvs/Frank-ZvIKOxyS/lib/python3.5/site-packages (python 3.5)
(Frank-ZvIKOxyS) bash-3.2$
有人可以告诉我如何开始修复此问题。为此寻找超过30个小时..
我在Macbook macOS 10.13.4上。
我知道这不是一个编程问题,但我想开始编程,这是一个先决条件..
答案 0 :(得分:2)
如果您想在创建python
时使用特定版本的virtualenv
,则应使用--python
标记:
virtualenv --python=/usr/local/lib/python3.6 <path/to/new/virtualenv/>
如果您使用pipenv
,则只需使用:
pipenv --python 3.6
答案 1 :(得分:0)
(Frank-ZvIKOxyS) bash-3.2$ exit
exit
MacBook-Pro-Frank:~ Frank$ pipenv --python 3.6
Virtualenv already exists!
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/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/Frank/.local/share/virtualenvs/Frank-ZvIKOxyS/bin/python3.6
Also creating executable in /Users/Frank/.local/share/virtualenvs/Frank-ZvIKOxyS/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location: /Users/Frank/.local/share/virtualenvs/Frank-ZvIKOxyS
测试:
MacBook-Pro-Frank:~ Frank$ pipenv shell
Spawning environment shell (/bin/bash). Use 'exit' to leave.
bash-3.2$ . /Users/Frank/.local/share/virtualenvs/Frank-ZvIKOxyS/bin/activate
Frank-ZvIKOxyS) bash-3.2$ python --version
Python 3.6.5
(Frank-ZvIKOxyS) bash-3.2$ pip --version
pip 10.0.1 from /Users/Frank/.local/share/virtualenvs/Frank-
ZvIKOxyS/lib/python3.6/site-packages/pip (python 3.6)
(Frank-ZvIKOxyS) bash-3.2$
感谢Alberto,这解决了我的难题。
令人费解......