How to change the default directory of PowerShell in Anaconda Navigator?

荒凉一梦 提交于 2021-02-11 17:51:10

问题


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.

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

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

C:\Users\Administrator

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.

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


回答1:


Changing the path to D:/ drive is one way. If that does not work, try re-installing, I know this sounds time-consuming, but I have faced a similar issue time and again.




回答2:


A simple fix that I found:

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.

Inside, create a new file called profile.ps1.

Inside the file, type in this line of code:

Set-Location "YOUR_FILE_PATH"

Save the file, and restart the PowerShell interface.

Your default directory will be changed.



来源:https://stackoverflow.com/questions/61289618/how-to-change-the-default-directory-of-powershell-in-anaconda-navigator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!