[英]Creating Conda environment in windows 10 (but cannot reference to local directory)
there are some strange problems regarding to conda (anaconda) on my local machine (windows 10). 关于本地计算机(Windows 10)上的conda(anaconda),存在一些奇怪的问题。 After installed, I tried to create an environment like 安装后,我尝试创建一个类似
conda create -n test
then the environment is successfully created. 则环境创建成功。 Furthermore, the environment can reference to my local directory also, sth like C:\\users\\user_a\\conda\\conda\\env\\test. 此外,环境还可以引用我的本地目录,例如C:\\ users \\ user_a \\ conda \\ conda \\ env \\ test。 Verify using sys.path also 还要使用sys.path进行验证
but then when I create another environment using similar command: 但是当我使用类似的命令创建另一个环境时:
conda create -n test2
the environment test2 can only reference to the global package. 环境test2只能引用全局包。 Using sys.path showing it can only lookup global package directory also. 使用sys.path显示它也只能查找全局包目录。
I tried to uninstall the whole OS / anaconda but no avail... What's the problem here? 我试图卸载整个OS / anaconda,但无济于事……这是什么问题?
*Edit I have edit with the correct syntax. *编辑我使用正确的语法进行编辑。 And I have already activated my environment to check sys.path 而且我已经激活了我的环境来检查sys.path
*Edit 2 Here is the sys.path for respective environments: { ['', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test\\\\python36.zip', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test\\\\DLLs', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test\\\\lib', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test\\\\lib\\\\site-packages', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test\\\\lib\\\\site-packages\\\\IPython\\\\extensions', 'C:\\\\Users\\\\test_user\\\\.ipython']
and *编辑2这是各个环境的sys.path:{ ['', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test\\\\python36.zip', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test\\\\DLLs', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test\\\\lib', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test\\\\lib\\\\site-packages', 'D:\\\\ProgramFiles\\\\Anaconda3\\\\envs\\\\test\\\\lib\\\\site-packages\\\\IPython\\\\extensions', 'C:\\\\Users\\\\test_user\\\\.ipython']
和
'', 'D:\\Documents\\dev\\python\\my_projects\\my_proj', 'D:\\ProgramFiles\\Anaconda3\\python37.zip', 'D:\\ProgramFiles\\Anaconda3\\DLLs', 'D:\\ProgramFiles\\Anaconda3\\lib', 'D:\\ProgramFiles\\Anaconda3', 'D:\\ProgramFiles\\Anaconda3\\lib\\site-packages', 'D:\\ProgramFiles\\Anaconda3\\lib\\site-packages\\win32', 'D:\\ProgramFiles\\Anaconda3\\lib\\site-packages\\win32\\lib', 'D:\\ProgramFiles\\Anaconda3\\lib\\site-packages\\Pythonwin', 'D:\\ProgramFiles\\Anaconda3\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\test_user\\.ipython'
Thanks. 谢谢。
To create an environment you use conda create
: 要创建环境,请使用conda create
:
c:\> conda create -n test
c:\> conda create -n test2
Activate the environments using activate: 使用激活激活环境:
c:\> activate test
c:\> python -c "import sys; print(sys.executable, sys.path)"
c:\> deactivate
c:\> activate test2
c:\> python -c "import sys; print(sys.executable, sys.path)"
c:\> deactivate
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.