lin*_*inX 70 virtualenv anaconda conda
软件包的默认位置是我的主目录中的.conda文件夹.但是,在我使用的服务器上,我可以使用的空间有一个非常严格的限制,这基本上避免了我在我的主目录下放置任何东西.如何指定要创建的虚拟环境的位置?谢谢!服务器正在运行Ubuntu.
Pau*_*aul 85
使用--prefix或-p选项指定写入环境文件的位置.例如:
conda create --prefix /tmp/test-env python=2.7
Run Code Online (Sandbox Code Playgroud)
将创建名为的/tmp/test-env驻留环境/tmp/而不是默认环境.conda.
小智 38
像保罗说的,用
conda create --prefix=/users/.../yourEnvName python=x.x
Run Code Online (Sandbox Code Playgroud)
如果您位于要在其中创建虚拟环境的文件夹中,则只需省略路径并使用
conda create --prefix=yourEnvName python=x.x
Run Code Online (Sandbox Code Playgroud)
conda仅跟踪anaconda文件夹内文件夹envs中包含的环境.下次需要激活新的环境时,请移动到创建它的文件夹并激活它
source activate yourEnvName
Run Code Online (Sandbox Code Playgroud)
Moh*_*nan 11
你可以这样创建
conda create --prefix C:/tensorflow2 python=3.7
Run Code Online (Sandbox Code Playgroud)
并且您不必移动到该文件夹来激活它。
# To activate this environment, use:
# > activate C:\tensorflow2
Run Code Online (Sandbox Code Playgroud)
如你所见,我是这样做的。
D:\Development_Avector\PycharmProjects\TensorFlow>activate C:\tensorflow2
(C:\tensorflow2) D:\Development_Avector\PycharmProjects\TensorFlow>
(C:\tensorflow2) D:\Development_Avector\PycharmProjects\TensorFlow>conda --version
conda 4.5.13
Run Code Online (Sandbox Code Playgroud)
Chr*_*ber 10
当使用该--prefix选项时,每次创建环境时都必须显式使用它。如果您只想将环境默认存储在其他位置,则可以在.condarc文件中进行配置。
请参阅:https : //conda.io/docs/user-guide/configuration/use-condarc.html#specify-environment-directories-envs-dirs
我遇到了类似的情况。我确实可以访问更大的数据驱动器。根据您的情况以及您对服务器的访问权限,您可以考虑
ln -s /datavol/path/to/your/.conda /home/user/.conda
Run Code Online (Sandbox Code Playgroud)
然后后续的 conda 命令会将数据放入 datavol 中的符号链接目录中
If you want to use the --prefix or -p arguments, but want to avoid having to use the environment's full path to activate it, you need to edit the .condarc config file before you create the environment.
The .condarc file is in the home directory; C:\Users\<user> on Windows. Edit the values under the envs_dirs key to include the custom path for your environment. Assuming the custom path is D:\envs, the file should end up looking something like this:
ssl_verify: true
channels:
- defaults
envs_dirs:
- C:\Users\<user>\Anaconda3\envs
- D:\envs
Run Code Online (Sandbox Code Playgroud)
Then, when you create a new environment on that path, its name will appear along with the path when you run conda env list, and you should be able to activate it using only the name, and not the full path.
In summary, if you edit .condarc to include D:\envs, and then run conda env create -p D:\envs\myenv python=x.x, then activate myenv (or source activate myenv on Linux) should work.
Hope that helps!
PS我通过反复试验偶然发现了这一点。我认为会发生什么情况,当您编辑envs_dirs密钥,conda更新~\.conda\environments.txt以包括在下方指定的所有目录中找到的环境时envs_dirs,可以在不使用绝对路径的情况下访问它们。
| 归档时间: |
|
| 查看次数: |
65672 次 |
| 最近记录: |