问题
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