简体   繁体   English

在Windows 10中创建Conda环境(但不能引用本地目录)

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

相关问题 在 windows 10 中创建 conda 环境时出错 - Error while creating conda environment in windows 10 如何在 Windows 10 上的 VSCode 中激活 conda 环境 - How to activate conda environment in VSCode on Windows 10 conda环境激活报错:“系统找不到指定的路径。” (窗户 10) - Conda environment activation error: “The system cannot find the path specified.” (windows 10) 如何在Windows 10中创建Conda环境 - How do I create Conda environment in Windows 10 Anaconda:将本地二进制包安装到Windows中的conda环境中 - Anaconda: Install local binary package to conda environment in Windows Conda:创建虚拟环境 - Conda: Creating a virtual environment Conda 找不到要安装的本地包,尽管它存在于环境的 conda-bld 目录中 - Conda doesn't find local package to install, although it's present in the environment's conda-bld directory conda install -c conda-forge python-pdal解决环境: 在运行Windows 10时挂起 - conda install -c conda-forge python-pdal Solving environment: | hangs when running windows 10 通过conda安装了pytorch,但是不能在Windows 10中导入 - Installed pytorch through conda, but cannot import in Windows 10 警告:目标位置“...”中已经存在一个目录,但它不是 conda 环境。 继续创建环境 (y/[n])? - WARNING: A directory already exists at the target location '…' but it is not a conda environment. Continue creating environment (y/[n])?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM