我知道这种问题已经问过很多次了。我什至发现了几乎相同的问题:How to use pip3 for python 3.6 instead of python 3.5? 但是我仍然没有解决我的问题。我正在使用os x。
我有python的三个版本:2.7、3.6和3.7。
{
"ORGANIZATION":[
{
" id":101,
"category_name":"Organization 1",
"description":" ",
"WING ":[
//this is the category children which can also be a subcategory {
"id":122,
"category_name":"wing 1",
"description":"",
"FLOOR":[
{
"id":111,
"category_name":"floor 1"
}
]
},
{
"id":555,
"category_name":"wing 2",
"description":""
},
{
"id":222,
"category_name":"wing 3",
"description":""
}
]
},
{
"id":11111,
"category_name":"organization 2",
"description":"",
"WING":[
{
"id":4545,
"category_name":"wing 1",
"description":""
},
{
"id":252,
"category_name":"wing 2",
"description":"",
"FLOOR":[
{
"id":131,
"category_name":"floor 1",
"description":""
}
]
},
{
"id":2526,
"category_name":"Wing 3 ",
"description":"",
"FLOOR":[
{
"id":87,
"category_name":"floor 2",
"description":""
},
{
"id":565,
"category_name":"floor 3",
"description":"",
"ROOM":[
// here is an example of a child that is a sub-category also {
"id":555,
"category_name":"room 1",
"description":""
},
{
"id":584,
"category_name":"room 2",
"description":""
},
{
"id":77,
"category_name":"room 3",
"description":""
}
]
}
]
}
]
}
]
}
但如果我这样做
python --version
Python 2.7.10
python3 --version
Python 3.7.4
我不知道为什么pip3指向3.6而不是3.7(而python3给我3.7)
如果我愿意
pip3 --version
pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (python 3.6)
我有
python3
import site; site.getsitepackages()
PIP3指向python 3.6而不是3.7。如何使它指向python 3.7?
我尝试将python3添加到路径,但无济于事。我不想卸载python 3.6。
答案 0 :(得分:1)
养成使用以下内容的习惯;
python -m pip install <package> # and you will be sure to have the package attached with the right version of python
例如:-
$ python3 -m pip install requests
答案 1 :(得分:0)
我最终在bash_profile中使用了它
alias pip3='/usr/local/bin/python3 -m pip'
答案 2 :(得分:-1)
$ which pip3
/usr/bin/pip3
$ nano /usr/bin/pip3
在文件的第一行,您应该看到
#!/usr/bin/python3
只需将其更改为所需的python版本即可。
#!/usr/bin/python3.7
or
#!/usr/bin/python3.8
保存。完成!