Python Forum
Path must be screwed up somewhere
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Path must be screwed up somewhere
#1
I am using Windows 11 and I have studied python a little bit and have gone through tutorials, however:

At the moment, something has to be screwed up in my python paths. I had uninstalled and reinstalled Python for Windows and have version 3.12 available. Installing established the path C:\Users\Me\AppData\Local\Programs\Python\Launcher\ where Me is substituted here for the real directory. When I go into any cmd program or power shell is where the problems are evident.

Establsihed for me are the path variables "c:\users\Me\appdata\roaming\python\python312\site-packages" and "C:\Users\Me\AppData\Roaming\Python\Python312\site-packages\scrapy".

Under the roaming folder in file explorer, there is not a folder relating to "\Python\Python312\site-packages\scrapy" nor is there
Looking in C:\Users\Me\AppData\Local\pip\cache should there be anything left in there?

The installation of Python this morning has a "Launcher" folder and a "Python312" folder under C:\Users\Bruce\AppData\Local\Programs\Python.

When attempting to install a virtual environment I tried running a pip command "pip install virtualenv" which produced a error saying "The term 'pip' is not recognized as the name of a cmdlet and a whole bunch of other such lingo.

If this issue is a issue with the path, I am not sure how to fix this given the path variables I showed above.
Reply
#2
To create a virtual environment you do python3 -m venv venv. If using windows I think it will be py -m venv venv. Not sure haven't used windows in a while.
The last venv will be the folder for the environment note doesn't have to be named that. I usually use .venv for clarification.
then (on linux, windows may be different) source .venv/bin/activate to start the virtual enviroment.
Then use pip to install any needed modules for the environment.
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts


Reply
#3
What do you get if you type “pip list”?
Reply
#4
Do this in cmd.
Example.
C:\>py --version
Python 3.12.2

C:\>py --list-paths
 -V:3.12 *        C:\Python312\python.exe
 -V:3.11          C:\Python311\python.exe
..... ect
So py should/will always work as when you install Python a py.exe in placed in C:\windows folder.
Then it bypass Environment Variables Path as windows folder is always in Path.

Now have all info to fix Environment Variables Path.
Eg if you get path as posted when do test over,remember that also Scripts folder shall be in system path.
Remove all other Python Paths.
c:\users\Me\appdata\roaming\python\python312
c:\users\Me\appdata\roaming\python\python312\Scripts
Then test in cmd again doing this,now should python and pip work.
C:\>python --version
Python 3.12.2

C:\>pip --version
pip 24.0 from C:\Python312\Lib\site-packages\pip (python 3.12)
Reply
#5
Quote:To create a virtual environment you do python3 -m venv venv
That is one way to make a virtual environment. I think the venv package that comes with python is a limited version of the virtualenv package you can install using pip.

The command for installing virtualenv via pip is:
python -m pip install --user virtualenv

Or using pipx:
python -m pip install --user virtualenv

Read about it here:
https://virtualenv.pypa.io/en/latest/installation.html
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Fatally screwed my Data Base up-maybe? hammer 4 3,332 Jan-28-2022, 12:21 AM
Last Post: Larz60+
  WebDriverException: Message: 'PATH TO CHROME DRIVER' executable needs to be in PATH Led_Zeppelin 1 3,194 Sep-09-2021, 01:25 PM
Last Post: Yoriz
  .pth file does not show up in sys.path when configuring path. arjunsingh2908 2 7,588 Jul-03-2018, 11:16 AM
Last Post: arjunsingh2908

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020