workon dal ✭ ✱
(dal)➜ Server (master)
检查python版本是否正确
pyenv versions ✭ ✱
system
2.7
3.2.1
* 3.4.2 (set by /Volumes/dev/Backend/DAL/Server/.python-version)
venv34
但安装时,它安装在2.7而不是3.4.2
(dal)➜ Server (master) pip install -r requirements.txt ✭ ✱
Requirement already satisfied (use --upgrade to upgrade): Flask==0.10.1 in /Users/partuck/.virtualenvs/dal/lib/python2.7/site-packages (from -r requirements.txt (line 1))
...
Requirement already satisfied (use --upgrade to upgrade): argparse in /Users/partuck/.virtualenvs/dal/lib/python2.7/site-packages (from stevedore==1.2.0->-r requirements.txt (line 13))
注意路径中的 python2.7 。
如何告诉pip在3.4.2下安装它?
编辑: 试过,例如
(dal)➜ Server (master) pip3 install itsdangerous
并将其安装在主python环境下,而不是专门用于dal
virtualenv。
证明:
(dal)➜服务器(主)pip3安装其危险✭✱
Requirement already satisfied (use --upgrade to upgrade): itsdangerous in /usr/local/lib/python3.4/site-packages
Cleaning up...
EDIT2:
输入时
eval "$(pyenv init -)"
按照pyenv指南中的建议,我看到了
python --version
Python 3.4.2
但是,当进入pyhton控制台时
python ✭ ✱
Python 2.7.9 (default, Dec 19 2014, 06:00:59)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.