美文网首页ITS·黑客
python环境搭建

python环境搭建

作者: JEZAU | 来源:发表于2017-03-31 12:04 被阅读0次

安装python

安装homebrew(补充一下!https://www.jianshu.com/p/b1de316fc3fc)

终端输入brew install python3

进入python

appledeMacBook:~ JEZAU$ python3

mac上直接输入python默认进入2.7

查找路径:

直接在终端输入

python -c "import sys; print sys.executable"

which  python

打开python后输入

import sys

sys.executable

或import sys

print sys.path

import sys

print(sys.path)

修改默认路径(没成功

print(sys.path)

/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6

alias python=“刚查到的你电脑中的路径/..”

一定要到文件 不可以是一个目录 否则提示:

-bash: /usr/local/Cellar/python3/3.6.1: is a directory

import sysappledeMacBook:~ JEZAU$ alias python="/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6"

重启终端

退出python

ctrl+z

exit()

直接在mac终端换行 \+空格

相关文章

网友评论

    本文标题:python环境搭建

    本文链接:https://www.haomeiwen.com/subject/sszmottx.html