[英]Screen inside conda environment doesn't use python PATH
I have a conda environment that is running python 3.10.5.我有一个运行 python 3.10.5 的 conda 环境。 It works on the terminal without screen.它在没有屏幕的终端上工作。 First I did首先我做了
conda deactivate
And conda info
at this step shows:此步骤的conda info
显示:
active environment : base
active env location : /home/myuser/anaconda3
shell level : 1
user config file : /home/myuser/.condarc
populated config files :
conda version : 4.13.0
conda-build version : 3.21.8
python version : 3.9.12.final.0
virtual packages : __cuda=10.2=0
__linux=5.4.0=0
__glibc=2.27=0
__unix=0=0
__archspec=1=x86_64
base environment : /home/myuser/anaconda3 (writable)
conda av data dir : /home/myuser/anaconda3/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/myuser/anaconda3/pkgs
/home/myuser/.conda/pkgs
envs directories : /home/myuser/anaconda3/envs
/home/myuser/.conda/envs
platform : linux-64
user-agent : conda/4.13.0 requests/2.27.1 CPython/3.9.12 Linux/5.4.0-109-generic ubuntu/18.04.6 glibc/2.27
UID:GID : 1001272705:1000000513
netrc file : None
offline mode : False
then I did然后我做了
screen -S scren_name
and the conda info
at this step is这一步的conda info
是
active environment : base
active env location : /home/myuser/anaconda3
shell level : 1
user config file : /home/myuser/.condarc
populated config files :
conda version : 4.13.0
conda-build version : 3.21.8
python version : 3.9.12.final.0
virtual packages : __cuda=10.2=0
__linux=5.4.0=0
__glibc=2.27=0
__unix=0=0
__archspec=1=x86_64
base environment : /home/myuser/anaconda3 (writable)
conda av data dir : /home/myuser/anaconda3/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/myuser/anaconda3/pkgs
/home/myuser/.conda/pkgs
envs directories : /home/myuser/anaconda3/envs
/home/myuser/.conda/envs
platform : linux-64
user-agent : conda/4.13.0 requests/2.27.1 CPython/3.9.12 Linux/5.4.0-109-generic ubuntu/18.04.6 glibc/2.27
UID:GID : 1001272705:1000000513
netrc file : None
offline mode : False
then I activated the environment in screen.然后我在屏幕中激活了环境。 Now conda info
says现在conda info
说
active environment : catvehicle
active env location : /home/myuser/anaconda3/envs/catvehicle
shell level : 2
user config file : /home/myuser/.condarc
populated config files :
conda version : 4.13.0
conda-build version : 3.21.8
python version : 3.9.12.final.0
virtual packages : __cuda=10.2=0
__linux=5.4.0=0
__glibc=2.27=0
__unix=0=0
__archspec=1=x86_64
base environment : /home/myuser/anaconda3 (writable)
conda av data dir : /home/myuser/anaconda3/etc/conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/linux-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /home/myuser/anaconda3/pkgs
/home/myuser/.conda/pkgs
envs directories : /home/myuser/anaconda3/envs
/home/myuser/.conda/envs
platform : linux-64
user-agent : conda/4.13.0 requests/2.27.1 CPython/3.9.12 Linux/5.4.0-109-generic ubuntu/18.04.6 glibc/2.27
UID:GID : 1001272705:1000000513
netrc file : None
offline mode : False
However, when I write python
in screen, the version shown is the default Ubuntu 18.04 included python which is 2.7, and not the 3.10.5 version that was part of my conda env.但是,当我在屏幕上编写python
时,显示的版本是默认的 Ubuntu 18.04 包含的 python 2.7,而不是我的 conda env 中的 3.10.5 版本。
how can I fix this, or make it use the proper python?我该如何解决这个问题,或者让它使用正确的python?
Edit: as mentioned by other users, setting an alias is not recommended.编辑:正如其他用户所提到的,不建议设置别名。 I was able to fix it by:我能够通过以下方式修复它:
conda deactivate
until the (base)
environment was no longer activated either.编写conda deactivate
直到(base)
环境也不再被激活。conda activate my_env
to activate.编写conda activate my_env
来激活。 Now the python
path is correct.现在python
路径是正确的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.