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
Script requirements: Back up the MySQL database e...
Table of contents Background 1. What is dns-prefe...
This article records the detailed installation tu...
My mysql version is MYSQL V5.7.9, please use the ...
This article shares the detailed steps of install...
Linux is an open system. Many ready-made programs...
As the computer is used, a lot of garbage will be...
Recently, a new requirement "front-end cache...
The first method: Use Junge's one-click scrip...
This article describes the example of MySQL sched...
This article shares the specific code of jQuery t...
The GROUP BY syntax can group and count the query...
es installation docker pull elasticsearch:7.4.0 #...
Data Type: The basic rules that define what data ...
Table of contents 1. Problem description: 2. Trou...