[英]How can I check which installation of python I'm using and remove all others?
I was trying to import pandas, and I have Anaconda installed but when I run it, it says ImportError: No module named pandas
我正在尝试导入熊猫,并且已经安装了Anaconda,但是在运行它时,它显示
ImportError: No module named pandas
So in terminal, I typed which -a python
and the output was usr/bin/python
因此,在终端中,我键入
which -a python
,输出为usr/bin/python
Then I typed in the command ls -l /usr/bin/python*
and my output was: 然后我输入命令
ls -l /usr/bin/python*
,我的输出是:
-rwxr-xr-x 1 root wheel 66736 May 5 2016 /usr/bin/python
-rwxr-xr-x 5 root wheel 925 Oct 23 2015 /usr/bin/python-config
lrwxr-xr-x 1 root wheel 75 May 19 2016 /usr/bin/python2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
lrwxr-xr-x 1 root wheel 82 May 19 2016 /usr/bin/python2.6-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6-config
lrwxr-xr-x 1 root wheel 75 May 19 2016 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x 1 root wheel 82 May 19 2016 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x 1 root wheel 66736 May 5 2016 /usr/bin/pythonw
lrwxr-xr-x 1 root wheel 76 May 19 2016 /usr/bin/pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
lrwxr-xr-x 1 root wheel 76 May 19 2016 /usr/bin/pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
I run my scripts by creating a PATH variable in terminal and running the script in terminal. 我通过在终端中创建PATH变量并在终端中运行脚本来运行脚本。 I wanted to know which python I'm using and what/how I can rid of the other ones that are unnecessary.
我想知道我正在使用哪个python,以及如何/如何摆脱其他不必要的python。 So for example, I would write something like
export ENGINE=/home/username/Software/...
and then each time I wanted to execute a python script in terminal I just call it like $ENGINE test.py
因此,例如,我将编写类似于
export ENGINE=/home/username/Software/...
,然后每次我想在终端中执行python脚本时,我都将其命名为$ENGINE test.py
如果您正在使用Anaconda和根环境,只需在终端中运行python -V
,它将打印版本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.