简体   繁体   English

如何检查正在使用的python安装并删除所有其他安装?

[英]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.

相关问题 如何判断我正在使用哪个 python 实现? - How can I tell which python implementation I'm using? 如何检查我使用的是哪个版本的 NumPy? - How do I check which version of NumPy I'm using? 我如何知道我使用的是哪个 Python 解释器? - How do I tell which Python interpreter I'm using? 我正在使用一个期待 Python3 的项目。 如何在不搞砸任何事情的情况下使用它? - I’m using a project which is expecting Python3. How can use that without messing anything up? 如何删除 python 安装和我安装的所有软件包以重新开始 - How do I remove python installation and all the packages I installed for a fresh start 使用python矩阵M(使用numpy),如何将该矩阵的每一列与所有其他列进行比较? - With a python matrix M (using numpy), how can I compare each column of that matrix with all other columns? 如果不使用子进程,如何使用python读取stderr? - How can I read stderr with python if I'm NOT using subprocess? 使用Python,如何检查`if or`语句中的哪个对象返回`True`? - Using Python, how can I check which object in an `if or` statement returned `True`? 如何检查哪个用户当前使用python登录计算机? - How can i check which user is currently logged in on the computer with python? 如何检查Python运行哪个Window Manager? - How can I check with Python which Window Manager is running?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM