Python Set up Guide
Setting Up Python 3.13, Virtual Environments, and Nexus Repository
π Introduction
This guide walks you through setting up Python 3.13, configuring pip, and working with virtual environments. Additionally, it includes steps for integrating with a custom package repository (such as Nexus or PyPI mirrors).
πΉ Step 1: Uninstall Existing Python Versions (If Needed)
If you have older Python versions and want a fresh installation, uninstall them first:
- Open Control Panel β Programs & Features β Uninstall Python.
- Delete leftover Python folders manually:
Terminal window C:\Users\YourUsername\AppData\Local\Programs\Python\C:\PythonXX\ # (If installed in Program Files)
πΉ Step 2: Download and Install Python 3.13
- Visit the official Python website and download Python 3.13.
- Run the installer and select Customize Installation.
- Ensure the following options are checked:
β
pip
βAdd Python to PATH
βInstall for all users
(recommended) - Click Next and complete the installation.
Verify Installation
After installation, open Command Prompt and run:
python --versionpip --version
β Expected Output:
Python 3.13.xpip 23.x.x from C:\Python313\Lib\site-packages\pip (python 3.13)
πΉ Step 3: Configure pip with a Custom Package Repository (Optional)
If using a private package repository (e.g., Nexus, Artifactory, or a corporate mirror):
- Set the package index URL:
Terminal window pip config set global.index-url https://your-custom-repo-url/ - Set trusted hosts:
Terminal window pip config set global.trusted-host your-custom-repo-url - Set global timeout:
Terminal window pip config set global.timeout 60
To verify, try installing a package:
pip install pandas
β The package should download from your configured repository.
πΉ Step 4: Setting Up a Virtual Environment
A virtual environment allows you to create an isolated Python workspace for your projects.
Create a Virtual Environment
Navigate to your project directory and run:
python -m venv myenv
β
If successful, it will create a folder named myenv
.
Activate the Virtual Environment
- Windows (Command Prompt):
Terminal window myenv\Scripts\activate - Windows (PowerShell):
Terminal window myenv\Scripts\Activate.ps1
Your terminal will now show (myenv)
at the beginning of the prompt.
Install Packages Inside Virtual Environment
pip install requests numpy pandas
Verify installed packages:
pip list
To deactivate the virtual environment:
deactivate
πΉ Step 5: Running a Python Script
- Create a new Python file outside the virtual environment:
Terminal window echo "print('Hello, World!')" > hello.py - Run the script:
Terminal window python hello.py
β Expected Output:
Hello, World!
πΉ Step 6: Fixing βScript Not Found in PATHβ Warnings
If you see a warning like:
The script f2py.exe and numpy-config.exe are installed in 'C:\Users\YourUsername\AppData\Roaming\Python\Python313\Scripts\'which is not on PATH. Consider adding this directory to PATH.
Solution: Add the Path to Environment Variables
- Open System Environment Variables (
sysdm.cpl
β Advanced β Environment Variables). - Find Path under System Variables and click Edit.
- Click New and add:
C:\Users\YourUsername\AppData\Roaming\Python\Python313\Scripts\
- Click OK, restart your terminal, and retry your commands.
π Conclusion
You have now successfully:
β Installed Python 3.13
β Configured pip
with a package repository
β Created and activated a virtual environment
β Installed packages and ran a Python script
This setup ensures clean dependency management and avoids system-wide conflicts. Happy coding! π―