如何在Anaconda Navigator中更改PowerShell的默认目录? [英] How to change the default directory of PowerShell in Anaconda Navigator?

查看:162
本文介绍了如何在Anaconda Navigator中更改PowerShell的默认目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows 7的Anaconda Navigator 1.9.12版本以及Python 3.7.6.我最近安装了此软件来研究Pytorch.

I am using Anaconda Navigator version 1.9.12 for Windows 7, along with Python 3.7.6. I installed this recently to study Pytorch.

为了释放我的 C:\ 驱动器中的空间,我在 D:\ 驱动器中的以下地址创建了主要的Pytorch文件夹:

In order to free up space in my C:\ drive, I created my main Pytorch folder in my D:\ drive at the address of :

D:\ Pytorch_folder \ Pytorch

但是,每次我通过Anaconda打开Powershell Prompt时,默认目录始终为:

However, every single time I open up Powershell Prompt through Anaconda, the default directory is always:

C:\ Users \ Administrator

恰好是%HOMEPATH%环境变量.我在问题中尝试了很多建议,包括更改默认设置通过属性" 开始目录.我知道我可以使用 cd 命令访问我的文件夹,但是每次这样做都是很烦人的.

Which happens to be the %HOMEPATH% environment variable. I've tried many suggestions in this question, including changing the default start directory through "Properties". I know I can access my folder using cd command, but it is annoying to do so every time.

是否可以在Anaconda Navigator中更改Powershell的默认目录?

Is there a way to change default directory for Powershell in Anaconda Navigator?

推荐答案

我发现的一个简单修复程序:

A simple fix that I found:

转到 C:\ Users \ YOUR_USER_NAME \ Documents 或任何默认的Document文件夹.然后,创建一个目录(如果尚不存在),称为 WindowsPowerShell .

Go to C:\Users\YOUR_USER_NAME\Documents or whatever your default Document folder is. Then, create a directory, if it doesn't exist already, called WindowsPowerShell.

在内部,创建一个名为 profile.ps1 的新文件.

Inside, create a new file called profile.ps1.

在文件中,输入以下代码行:

Inside the file, type in this line of code:

设置位置"YOUR_FILE_PATH"

保存文件,然后重新启动PowerShell界面.

Save the file, and restart the PowerShell interface.

您的默认目录将被更改.

Your default directory will be changed.

这篇关于如何在Anaconda Navigator中更改PowerShell的默认目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆