Anaconda installation on Mac and configure PyCharm
- I never wrote python, did not install any relevant IDE, here to make a record
Anaconda installation
From the official website to download, here chose Python3.7 graphical version of the installation package
After installation, enter the command line
conda --version
, if the installation is successful, it will display the version numberBut I did not show, so according to Anaconda Python's environment configuration (Mac version) to configure the environment variables:
First of all, find the location of bin files in the installation path Anaconda, my path
/opt/anaconda3/bin
(Re-recorded it in the finder of the "Show", select the "Show Path Bar", you can display the current position)
Modify
.bash_profile
filevim .bash_profile
Add the following statement after save and exit (PATH's address is the address of the bin file)
export PATH="/opt/anaconda3/bin:$PATH"
Enter the command line, just to make documents take effect immediately
source $HOME/.bash_profile
Test again
conda --version
and found success shows the version number
Recorded at the relevant command anaconda's (Environmental Management section)
# 环境管理 # 查看当前conda版本 conda --version # 查看当前所有环境(*表示当前所在环境) conda env list # 创建新的环境(version替换为相应python版本号) conda create -n EnvName python=version # 切换环境 source activate EnvName # 退出环境 conda deactivate # 移除指定的环境 conda remove -n EnvName --all
Part of the package management command
# 包管理 # 查看当前环境中的包 conda list # 查看指定环境下的包 conda list -n EnvName # 查找指定的包 conda search PacketName # 安装指定的包 conda install PacketName # 卸载指定的包 conda remove PacketName
Configured on PyCharm
Prior to this, we should use
conda create -n EnvName python=version
to create a good environment for a version of python, for example, I useconda create -n test1py3.7 python=3.7
to create an environment called test1py3.7Open PyCharm, select Create New Project
Modify the project name, and then select Project Interpreter == "Existing Interpreter ==> ...
- In the new interface that appears, select Conda Environment == "...
- Here, we are in before anaconda3 directory, choose to create a good test1py3.7 == under envs folder> bin ==> python3.7, OK
- Once selected, the following screen, select OK, then Create, waiting to create a good project
Create a python file, enter
print("Hello World!")
Right the .py file, select Run, success
Modify PyCharm interpreter
- Click PyCharm == "Preferences ...
- In the search input box
interpreter
, select Project Interpreter, you can view the currently selected interpreter and related packages, and make changes