Some time ago, I needed to use pip downloads frequently for development. Although I changed the pip source to a domestic source, I was still not satisfied with the speed. More importantly, the integrated test environment was offline. To develop in the integrated test environment, I obviously needed to build my own local pip source. Before using devpi, I used pip2pi, but there was a bug that caused the tox command in an offline environment to always fail, so I finally used devpi to build the pip source. Docker deployment is used here, which is convenient and fast. If it crashes accidentally, you only need to re-run the docker container. If Docker is not installed in your environment, you can search for installation methods yourself, such as the Docker community's document Install Docker. If you are a CentOS user, you can install it using the following method sudo yum update sudo yum -y install docker sudo systemctl enable docker sudo systemctl start docker Next, use docker to deploy a Python local image source. We can use the existing image on docker hub. I choose # Set the devpi server administrator password DEVPI_PASSWORD = 123 mkdir -p /src/docker/devpi mkdir /tmp/wheelhouse docker run -d --name devpi \ --publish 3141:3141 \ --volume /tmp/wheelhouse:/wheelhouse --volume /srv/docker/devpi:/data \ --env=DEVPI_PASSWORD=$DEVPI_PASSWORD \ --restart always \ muccg/docker-devpi Next, download the required wheel package locally. The content of the requirements.txt file is the list of Python libraries we need. pip wheel --wheel-dir /tmp/wheelhouse -r requirements.txt If the library downloaded from pip is already a wheel package, the file will be placed directly in /tmp/wheelhouse. ll /tmp/wheelhouse total 524K -rwxrwxrwx 1 rookie rookie 155K Apr 6 23:40 certifi-2019.3.9-py2.py3-none-any.whl -rwxrwxrwx 1 rookie rookie 131K Apr 6 23:40 chardet-3.0.4-py2.py3-none-any.whl -rwxrwxrwx 1 rookie rookie 58K Apr 6 23:40 idna-2.8-py2.py3-none-any.whl -rwxrwxrwx 1 rookie rookie 57K Apr 6 23:40 requests-2.21.0-py2.py3-none-any.whl -rwxrwxrwx 1 rookie rookie 116K Apr 6 23:40 urllib3-1.24.1-py2.py3-none-any.whl After the download is complete, if the local environment has the devpi client installed, you can directly upload the wheel package, but since we have already Mount # Enter the container docker exec -it -u root devpi bash # Log in and upload devpi use http://<host_ip>:3141/root/public --set-cfg devpi login root 123 devpi upload --from-dir /wheelhouse After uploading is complete, you can use For temporary use, you can use pip install's --index and --trusted-host options pip install --index http://<host_ip>:3141/root/public/+simple/ \ --trusted-host <host_ip> Or modify the pip.conf file to use it permanently # vim ~/.pip/pip.conf [global] index_url = http://<host_ip>:3141/root/public/+simple/ trusted-host = <host_ip> [search] index = http://<host_ip>:3141/root/public/ The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of how to use the mysql backup script mysqldump
>>: Understanding Vuex in one article
The usage of H tags, especially h1, has always bee...
background I want to check the webpack version, b...
Main library execution CREATE DATABASE test CHARA...
Introduction to Vue The current era of big front-...
1. unlink function For hard links, unlink is used...
Win10 system locally installed MySQL8.0.20, perso...
Uninstall the installed version on Ubuntu: sudo a...
Analyze the production steps: 1. Prepare resource...
Although the frequency of starting the shell is v...
I was working on a pop-up ad recently. Since the d...
Table of contents What is async? Why do we need a...
1. Install MySQL database ① Download and unzip an...
Preface A classmate is investigating MLSQL Stack&...
Configure Git environment in Docker At work, I en...
First delete mysql: sudo apt-get remove mysql-* T...