When you start a new python project, organize the steps to prepare the virtual environment as a memorandum.
Host OS: Windows 10 pro Virtualization software: VirtualBox 6.0 Guest OS: Linux Ubuntu 18.04 Integrated development environment: VS Code 1.44.2
Using venv is convenient because the packages introduced by pip can be made independent for each project. However, the version of python itself cannot be managed, so use another tool such as pyenv if necessary. (Explanation is omitted here)
$ mkdir {new_project_name}
$ cd {new_project_name}
$ python3 -m venv {venv_name} //venv_The name can be anything, but in principle it is venv because it is easy to use.
If the following error message is displayed, the python3-venv package is not installed, so install it with the apt command.
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
$ apt install python3-venv
Follow the steps below to create a setting file and save it as a new workspace.
$ cd {Project_Directory} // new_Move to the project directory
$ code . //Open VS Code
$ echo "/venv" > .gitignore
From now on, you can open the workspace with the following command
$ cd { Project_Directory } // new_Move to the project directory
$ code {new_workspace_name}.code-workspace
Create a new repository from the github website. Please refer to "4, Create a new repository on github" on the following site.
Add new repository to Github https://qiita.com/sodaihirai/items/caf8d39d314fa53db4db
Execute the following command from the terminal.
//
cd { Project_Directory } // new_Move to the project directory
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/{ User_Name }/{ Repository_Name }.git
git push -u origin master
You will be prompted to enter your github username and password, enter them and press enter. that's all.
venv: Python virtual environment management https://qiita.com/fiftystorm36/items/b2fd47cf32c7694adc2e
Recommended Posts