This is the second day of my participation in the November Gwen Challenge. Check out the details: the last Gwen Challenge 2021

Recently, I want to do a desktop program design. Because our company is in the Intranet environment, it is too troublesome to use Electron, so I plan to try PyQt.

After installing Anaconda on the company computer, the conda create -n py execution to create a new Python virtual environment failed.

When discovering Conda Create, it is necessary to connect to the official website of Conda, even if tsinghua image is used, it is also on the Internet, and the original Python source on our Intranet is pYPI.

At this point, after searching, three solutions were found:

  1. Use the Python package Virtualenv
  2. Set up a source on the Intranet
  3. Offline installation

The third is to treat the symptoms rather than the root cause, while the second requires too much space, so it is abandoned.

However, the first method can reuse the original PYPI source on our company’s Intranet, so the first method is adopted.

But there’s a hole here:

A mirror image of our company is based on the nexus, when need to copy address, window pops out is the address of the form such as http://ip_address:port/nexus3/repository/pypi-public/, in the following instructions that are executed according to the online tutorial configuration network source,

pip config set global.index-url http://ip_address:port/nexus3/repository/pypi-public/
Copy the code

PIP install virtualenv failed to find the package.

Folder C:\Users\{User name}\AppData\Roaming\ PIP \ pip.ini (Linux address ~/.pip/pip.conf) folder C:\Users\{User name}\AppData\Roaming\ PIP

The [global] trusted - host = {Intranet source IP address or domain name} index index - url = = http://ip_address:port/nexus3/repository/pypi-public/pypi http://ip_address:port/nexus3/repository/pypi-public/simpleCopy the code

PIP install virtualenv is successfully installed. In the configuration file above, the trusted_host entry is configured because if PIP install is not included, it will warn you that the current site is using HTTP, not HTTPS, or….

After installing the package, I went to a directory to create the virtual environment and selected the envs folder under the Anaconda directory.

Virtualenv Pyenv1: virtualEnv Pyenv1: VirtualEnv Pyenv1: VirtualEnv Pyenv1: VirtualEnv Pyenv1

In theory, the pyenv1\Scripts directory activate will already activate the virtual environment.

But here I step in another hole…

On Windows, I added the Scripts folder from the Anaconda installation directory to the environment variable, so when I went to pyenv1\Scripts and ran activate, nothing happened. At first I thought the instructions were wrong, but I couldn’t figure out what was wrong after watching many tutorials…

/actvate successfully cut the environment to Pyenv1

Run the deactivate command to exit the virtual environment.

Ps: if you are in a virtual environment, see your_env_name on the left of the command line.