简体   繁体   English

Anaconda / Python:更改Anaconda提示用户路径

[英]Anaconda / Python: Change Anaconda Prompt User Path

I want to change my Anaconda Prompt User file path.我想更改我的 Anaconda 提示用户文件路径。 Currently it is as follows:目前是这样的:

在此处输入图像描述

I want it to change to: C:\Users㕅90我要改成:C:\Users㕅90

How do I do this?我该怎么做呢?

The current version of anaconda I have is:我拥有的 anaconda 的当前版本是:

Python 3.6.3 |Anaconda, Inc.| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]

Go to Start and search for "Anaconda Prompt" - right click this and choose "Open File Location", which will open a folder of shortcuts.转到开始并搜索“Anaconda Prompt” - 右键单击​​它并选择“打开文件位置”,这将打开一个快捷方式文件夹。 Right click the "Anaconda Prompt" shortcut, choose "Properties" and you can adjust the starting dir in the "Start in" box.右键单击“Anaconda Prompt”快捷方式,选择“属性”,您可以在"Start in"框中调整起始目录。

In Windows, if you have the shortcut in your taskbar, right-click the "Anaconda Prompt" icon, you'll see:在 Windows 中,如果您的任务栏中有快捷方式,请右键单击“Anaconda Prompt”图标,您将看到:

  • Anaconda Prompt蟒蛇提示
  • Unpin from taskbar (if pinned)从任务栏取消固定(如果固定)
  • Close window关闭窗口

Right-click on "Anaconda Prompt" again .再次右键单击“Anaconda Prompt”。

Click "Properties"点击“属性”

Add the path you want your anaconda prompt to open up into in the "Start In:" section.在“开始:”部分中添加您希望您的 anaconda 提示打开的路径。

Note - you can also do this by searching for "Anaconda Prompt" in the Start Menu.注意- 您也可以通过在“开始”菜单中搜索“Anaconda Prompt”来执行此操作。 The directions above are specifically for the shortcut .上面的说明是专门针对快捷方式的

["

If you want to access folder you specified using Anaconda Prompt, try typing<\/i>如果要访问使用 Anaconda Prompt 指定的文件夹,请尝试键入<\/b><\/p>

cd C:\Users\u354590

Just Type the Drive Location you want to work with: This worked for me!只需输入您要使用的驱动器位置:这对我有用! For example you want to change to D drive in windows:比如你想在windows下改成D盘:

D:\

If you want to change to particular folder in the drive:如果要更改到驱动器中的特定文件夹:

cd D:\Newfolder

We can change drive and directory path by input of following command我们可以通过输入以下命令来更改驱动器和目录路径

cd /d d:\

Explanation: CHDIR [/D] [drive:][path]解释:CHDIR [/D] [驱动器:][路径]

cd /?

Main answer source in detail: https://stackoverflow.com/a/44985515/9558119主要答案详细来源: https://stackoverflow.com/a/44985515/9558119

In both: Anaconda prompt and the old cmd.exe, you change your directory by first changing to the drive you want, by simply writing its name followed by a ' : ', exe: F: , which will take you to the drive named 'F' on your machine.在 Anaconda 提示符和旧的 cmd.exe 中,您可以通过首先更改您想要的驱动器来更改目录,只需编写其名称后跟一个 ' : ', exe: F: ,它将带你到名为的驱动器'F' 在你的机器上。 Then using the command cd to navigate your way inside that drive as you normally would.然后像往常一样使用命令cd在该驱动器中导航。

Navigating to desired directory using CD is tedious.使用 CD 导航到所需的目录是乏味的。 Anaconda was opening in C:\Windows\System32 folder for me. Anaconda 正在为我打开 C:\Windows\System32 文件夹。 So I created a batch file called goPy.bat containing the following所以我创建了一个名为 goPy.bat 的批处理文件,其中包含以下内容

cd c:\users\myname\documents\python\scripts cd c:\users\myname\documents\python\scripts
Jupyter Notebook Jupyter 笔记本

and saved it in Windows\System32 All I have to do is type in goPy and Jupyter Notebook would open in the desired working directory并将其保存在 Windows\System32 我所要做的就是输入 goPy,Jupyter Notebook 将在所需的工作目录中打开

if you want to change the contents of PATH you are going to have to update the _conda_activate.bat and conda.bat files at this line如果要更改PATH的内容,则必须在此行更新 _conda_activate.bat 和 conda.bat 文件

@SET PATH=!_sysp!;!_sysp!\Library\mingw-w64\bin;!_sysp!\Library\usr\bin;!_sysp!\Library\bin;!_sysp!\Scripts;!_sysp!\bin;%PATH%

and then you will have to close anaconda prompt and then re-open.然后您将不得不关闭 anaconda 提示符,然后重新打开。

the _conda_activate.bat and conda.bat files are found at %%Users\"user"\anaconda3\condabin _conda_activate.bat 和 conda.bat 文件位于%%Users\"user"\anaconda3\condabin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM