You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
642 B
20 lines
642 B
import subprocess
|
|
import os
|
|
|
|
# Read the package name from ~pip.txt
|
|
with open("pip.txt", "r") as file:
|
|
package_name = file.read().strip()
|
|
|
|
# Define the package(s) you want to install
|
|
packages_to_install = [package_name]
|
|
|
|
# Loop through the list of packages and install them one by one
|
|
for package in packages_to_install:
|
|
try:
|
|
# Use subprocess to run the pip install command
|
|
subprocess.run(["pip", "install", package], check=True)
|
|
print(f"Successfully installed {package}")
|
|
except subprocess.CalledProcessError as e:
|
|
print(f"Failed to install {package}: {e}")
|
|
|
|
os.remove("pip.txt") |