Recently, I tried to install pypoetry on my windows. The python I used was installed from MS store. And I found something strange.
C:\Users\Liu.D.H>where python
C:\Users\Liu.D.H\AppData\Local\Microsoft\WindowsApps\python.exe
C:\Users\Liu.D.H\anaconda3\python.exe
C:\Users\Liu.D.H>C:\Users\Liu.D.H\anaconda3\python.exe
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.realpath("C:/Users/Liu.D.H/AppData/Roaming/pypoetry")
'C:\\Users\\Liu.D.H\\AppData\\Roaming\\pypoetry'
>>> exit()
C:\Users\Liu.D.H>python
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.realpath("C:/Users/Liu.D.H/AppData/Roaming/pypoetry")
'C:\\Users\\Liu.D.H\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\\LocalCache\\Roaming\\pypoetry'
>>> exit()
C:\Users\Liu.D.H>
I also tried the realpath of node.
C:\Users\Liu.D.H>node
Welcome to Node.js v14.18.1.
Type ".help" for more information.
> fs.realpathSync("C:/Users/Liu.D.H/AppData/Roaming/pypoetry")
Uncaught:
Error: ENOENT: no such file or directory, lstat 'C:\Users\Liu.D.H\AppData\Roaming\pypoetry'
at Object.realpathSync (fs.js:1800:7) {
errno: -4058,
syscall: 'lstat',
code: 'ENOENT',
path: 'C:\\Users\\Liu.D.H\\AppData\\Roaming\\pypoetry'
}
>
So, the %APPDATA%/sub_path location in windows is process-dependent?
Related
literally.
in cmd, I want to execute window's python, not conda's
but it always executes conda's
Like this:
C:\Users\RHS>python
Python 3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
What I want to execute is window's python.
Like this:
C:\Users\RHS\AppData\Local\Programs\Python\Python39>python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
I added PATH of python 3.9 and tried changing position of both.
but always same result
enter image description here
PS C:\WINDOWS\system32> python
Python 3.7.0a2 (v3.7.0a2:f7ac4fe, Oct 17 2017, 17:06:29) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import sys
>>> import numpy
PS C:\WINDOWS\system32> python
Python 3.7.0a2 (v3.7.0a2:f7ac4fe, Oct 17 2017, 17:06:29) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
PS C:\WINDOWS\system32>
I can not import the mentioned modules however it is not giving any error as well. Even in small program if I import any of these 3 the program just ends without doing anything.
I have only one installation of Python. No other verison.
Update:
PS C:\WINDOWS\system32> pip freeze
boto==2.49.0
boto3==1.9.115
botocore==1.12.115
bz2file==0.98
certifi==2019.3.9
chardet==3.0.4
docutils==0.14
gensim==3.7.1
idna==2.8
jmespath==0.9.4
nltk==3.4
numpy==1.16.2
python-dateutil==2.8.0
requests==2.21.0
s3transfer==0.2.0
scipy==1.2.1
singledispatch==3.4.0.3
six==1.12.0
smart-open==1.8.0
urllib3==1.24.1
PS C:\WINDOWS\system32> python
Python 3.7.0a2 (v3.7.0a2:f7ac4fe, Oct 17 2017, 17:06:29) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print(numpy.__version__)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'numpy' is not defined
>>> exit()
PS C:\WINDOWS\system32>
Maybe I am reading what you have given incorrectly, but the way you have given, you haven’t done any “import numpy” in that Python session before accessing numpy.version. Please confirm.
this is what the cmd shows:
C:\Users\74713\Documents>activate root
(root) C:\Users\74713\Documents>python
Python 3.6.2 |Anaconda custom (64-bit)| (default, Jul 20 2017, 12:30:02) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
this is what my IDE shows:
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 6.1.0 -- An enhanced Interactive Python.
the first one's version is 3.6.2 while the second one is 3.6.3
and because of that, I meet trouble in import torchtext, which works well in the cmd(3.6.2) while fails in my IDE(3.6.3)
When I open CMD (on windows 10) and enter python it initializes python 3.6.0
C:\>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Now I recently also installed 2.7.6 the interpreter. How can I call both version of Python from CMD?
desired outcome
C:\>python
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> ^Z
C:\>python2.6
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
You can use Python launcher for Windows:
Python 2.7 interptreter:
C:\> py -2.7
Python 3.6 interpreter:
C:\> py -3.6
You also can run a script with a specific interpreter:
C:\> py -2.7 myScript.py
If its windows machine, to open a specific version of python you can use py from the command line.
example:
py2.7 #for version 2.7
and
py3.6 #for version 3.6
if its a Linux machine you can use the following commands in the command line python
python2.7 #opens version 2.7
and
python3.6 #opens version 3.6
When I go to import requests on Windows 7, it comes up with this:
Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Please specify the other client to connect to: _
What do I do?