[PYTHON] A note on how to load a virtual environment in PyCharm

This is a memo of how to load a virtual environment with PyCharm (repeated).

Prerequisites

--Hereafter, assume that the virtual environment name is'hoge' --PyCharm is installed --You have already created a virtual environment with virtualenv and it is ready to be called with `work on hoge`.

Setup steps

1. Check the directory of the virtual environment

cdvirtualenvLet's execute the command in the virtual environment and check the directory where the virtual environment is saved.(I didn't know this and it took a lot of time)

# a.Start the virtual environment
$ workon hoge

# b.Change to the virtual environment directory
(hoge)$ cdvirtualenv

# c.Check the directory name
(hoge)$pwd
##In the case of the author, "C:\Users\me\Envs\"hoge" was displayed.

# d.Get the Python directory
(hoge)$ where python
##I think there will be two or more virtual and non-virtual environments. Step c.Find and copy the path that is in the same directory as.
## C:\Users\me\Envs\hoge\Scripts\python.exe (Copy this in this case)
## C:\Python\Python38\python.exe (This is for a non-virtual environment)

2. Settings on the PyCharm side

--a. When setting a virtual environment for a project that already exists -(1) With the project open, press Ctrl + Alt + s (or "File-> Settings ..." at the top of the screen) -(2) Enter "Project Interpreter". Display it on the screen, and the gear on the upper right-> Add -(3) Select Existing Environment in "Virtual env Environment" and paste the python file directory of the previous chapter 1-d into the Interpreter field. -(4) Press OK to create a virtual environment --b. If you want to set up a virtual environment when creating a new project -(1) New Project-> Open the screen "Project Interpreter: New Virtualenv environment" that appears. -(2) Paste the directory of the project you want to open in Location, and paste the directory of the python file in the previous chapter 1-d into Base Interpreter. -(3) Press create to complete the creation

that's all!

in conclusion

――I hope it helps beginners like you!

Recommended Posts

A note on how to load a virtual environment in PyCharm
How to build a new python virtual environment on Ubuntu
How to develop in a virtual environment of Python [Memo]
How to share a virtual environment [About requirements.txt]
How to create a Python virtual environment (venv)
[Note] How to create a Ruby development environment
[Note] How to create a Mac development environment
How to read environment variables from .env file in PyCharm (on Mac)
A memorandum on how to use keras.preprocessing.image in Keras
How to build a Django (python) environment on docker
How to build a Python environment on amazon linux 2
A note to load open data in CSV format into Cloudant on Bluemix
How to use VS Code in venv environment on windows
How to create a virtual bridge
How to build a LAMP environment using Vagrant and VirtulBox Note
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
From installing Ansible to building a Python environment in Vagrant's virtual environment
How to deploy a Django app on heroku in just 5 minutes
Install Django in a pipenv virtual environment
How to access environment variables in Python
How to build a sphinx translation environment
How to add a package with PyCharm
Creating a python virtual environment on Windows
How to get a stacktrace in python
How to use Anaconda interpreter in PyCharm
How to test on a Django-authenticated page
Creating a virtual environment in an Anaconda environment
I started Node.js in a virtual environment
How to change editor color in PyCharm
Add a Python virtual environment to VSCode
How to easily switch the virtual environment created by Conda on Jupyter
Unable to import packages installed in virtual environment with Anaconda on Windows 10
Steps to create a Python virtual environment with VS Code on Windows
How to install python package in local environment as a general user
How to clear tuples in a list (Python)
Ubuntu18.04.05 Creating a python virtual environment in LTS
How to embed a variable in a python string
[Latest] How to build Java environment on Ubuntu
Start Django in a virtual environment with Pipenv
How to create a JSON file in Python
Create a virtual environment with conda in Python
How to implement a gradient picker in Houdini
[Venv] Create a python virtual environment on Ubuntu
How to notify a Discord channel in Python
How to use pip3 under proxy environment Note
Work in a virtual environment with Python virtualenv.
How to live a decent life on 2017 Windows
[Python] How to draw a histogram in Matplotlib
How to create a Rest Api in Django
How to build Java environment on Ubuntu (Linux)
How to write a named tuple document in 2020
How to count numbers in a specific range
[TF] How to build Tensorflow in Proxy environment
How to read a file in a different directory
How to make Python Interpreter changes in Pycharm
How to Mock a Public function in Pytest
Create a Python virtual development environment on Windows
From nothing on Ubuntu 18.04 to setting up a Deep Learning environment in Tensor
How to quickly create a morphological analysis environment using Elasticsearch on macOS Sierra
How to run GUI programs such as tkinter in Python environment on WSL2
How to run a Django application on a Docker container (development and production environment)