essay | tech | year-summary | about

返回上级菜单

Python tips


日期:2024-06-01T00:00:00Z

python venv

https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/1120

You should check that python3-venv or virtualenv is installed.

python3 -c 'import venv' should not return any errors

python3 -m venv .venv/ should populate the directory

move python venv

https://stackoverflow.com/questions/34993200/copy-complete-virtualenv-to-another-pc

Do the following steps on the source machine:

    - workon [environment_name]
    - pip freeze > requirements.txt
    - copy requirements.txt to other PC

On the other PC:

    - create a virtual environment using mkvirtualenv [environment_name]
    - workon [environment_name]
    - pip install -r requirements.txt

python requirement

https://stackoverflow.com/questions/31684375/automatically-create-file-requirements-txt
https://github.com/bndr/pipreqs

pip install pipreqs
pipreqs /path/to/project