Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a Development Environment with PyCharm

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to build a development environment with PyCharm". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Download and install Vagrant

After the installation is complete, execute the vagrant box add hashicorp/precise64 command, and you will download an image on your computer. This image is for demonstration purposes only. If necessary, you can use your own customized image of the corresponding system.

When downloading, you will be prompted to choose virtualization software, where we choose virtualbox (Note: please install virtualbox in advance), which is both free and lightweight.

two。 Initialize the project

Enter my new project directory ~ / Code/Python/Vagrant-Project and perform vagrant init hashicorp/precise64 initialization.

Finally, start the virtual machine directly with this command vagrant up

After the virtual machine starts, you can use vagrant ssh to ssh directly into the virtual machine. (note: Windows can only log in to 127.0.0.1 Windows 2222 using remote login software, such as Xshell, or use Tools-> virtual machine).

In this image, Python 2.7.3 is built in, which is sufficient because it is used only for demonstration purposes.

The / vagrant/ directory in the virtual machine corresponds to the project root directory on your host

If you want to add more folder mappings, you can edit the Vagrantfile file by adding the following line before end

Config.vm.synced_folder "/ Users/MING/src", "/ srv/website"

Then execute the vagrant reload

3. Configure PyCharm

PyCharm deserves to be the most professional Python IDE, and it also provides very good support for Vagrant. But before using it, you need to configure it.

First, make sure your vagrant plug-in is installed

Then, configure the information for vagrant in Tools-> Vagrant

Finally, add the Python interpreter in the Vagrant virtual machine to Project-> Python Interpreter

After the configuration, no matter in Setting

Or the Python interpreters seen in the project interface are all Python in Vagrant.

In such an environment, all the new Python project files you create will be synchronized to the / vagrant/ directory in the Vagrant virtual machine. When you run the Python project locally, you are actually running in the Vagrant virtual machine.

If your Python project depends on a lot of components, you can install them all in this Vagrant virtual machine, package them into an image, and then send the image and project (including .vagrant folder and Vagrantfile) to your colleagues, and they will soon have a stable project running environment.

"how to use PyCharm to build a development environment" content is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report