简体   繁体   中英

Ubuntu terminal automatically executes a python script. How to stop it?

I'm using Ubuntu 19.10.

I recently installed PyTorch in the root environment of Anaconda3. After the installation, whenever I open the terminal window, a python script runs, and throws out import error "no module named conda".

I am unable to track down the file which the terminal is executing.

Here's the exact code:

Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
ImportError: No module named conda
anubhav@anubhav-ubuntu:~$

I tried tacking the file down in .bashrc and .bash_profile still no use of it.

How can I stop the terminal to execute the file?

To troubleshoot you could see what files Bash is reading from on startup:

echo exit | strace bash -li |& grep '^open[a-z]*'

(From AlexP 's answer on Unix & Linux. You could remove -l since Bash isn't in login mode by default on Ubuntu.)

You could also try bash -x , find the error, then the line immediately above will be the direct cause of the error.

确保您安装了多个版本的 python 并且正在为您的应用程序运行当前版本。

Type

$ ps -e | grep python

the id(s) you get, type them here

$ more /proc/ID/cmdline

to see which command started the Python process.

Not sure if you just upgrade or installed conda 4.8.0 rather than 4.7.12. Based on 9507 , a similar issue is raised since the conda was called before your anaconda was "declared", which means that it is the system python (which did not include conda) but not anaconda was called during the initiation. And they also provide a temporary solution in "piglesias1"'s comment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM