.bash_profile中的Python路径不被尊重 [英] Python path in .bash_profile not respected

查看:181
本文介绍了.bash_profile中的Python路径不被尊重的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

曾经谷歌搜索并且在这里搜索都无济于事,如果这是重复的话,请原谅我.

Been Googling and searching here to no avail, so forgive me if this is a duplicate.

基本上,我在机器上安装了Python 3.4(Mac运行的是Yosemite 10.10.2),但是当我在Terminal中运行python时,它将启动Python2.7.通常被提到是预装在Mac上.我已经使用vim检查了〜/.bash_profile,这是当前包含的内容:

Basically, I installed Python 3.4 on my machine (Mac running Yosemite 10.10.2), but when I run python in Terminal, it starts up Python2.7.whatever, which I'm assuming is the version that is often mentioned as coming pre-installed on Macs. I've checked my ~/.bash_profile using vim, and here's what it currently contains:

# Setting PATH for Python 3.4
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
export PATH

# Virtualenv Wrapper stuff
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh

根据我一直在做的所有阅读,应该可以.但事实并非如此.关于为什么的任何想法都得到赞赏.

Which, according to all the reading I've been doing, should work. But it isn't. Any and all thoughts as to why are appreciated.

推荐答案

通常,您只需键入python3python3.4即可获取特定版本.您应该尝试一下.

Usually you would just type python3 or python3.4 to get a specific version. You should try that.

大多数开发人员还使用虚拟环境,这些虚拟环境使您能够处理每个应用程序的python版本和模块.在 http://docs.python-guide.org/en上有介绍. /latest/dev/virtualenvs/

Most developers also use virtual environments which give you the ability to handle python versions and modules per application. There is an introduction at http://docs.python-guide.org/en/latest/dev/virtualenvs/

这篇关于.bash_profile中的Python路径不被尊重的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆